on 05-08-2014 4:13 PM
I am trying to copy rows from one datawindow to another. The source window has 19 rows in it, but when I update the destination window it only produces 1 Insert statement. Can anyone tell me why its not working or how to debug.
Here's the code:
uo_transaction ltran_Transact
string ls_SQLAnyConnectString
ls_SQLAnyConnectString = "ConnectString = 'DSN=dbbasesqlany;UID=" + is_DbLogon + ";PWD=" + is_DbPwd + " ' "
ltran_Transact = CREATE uo_transaction
ltran_Transact.DBMS = "ODBC"
ltran_Transact.dbParm = ls_SQLAnyConnectString
CONNECT USING ltran_Transact;
IF ltran_Transact.SQLError() THEN
ltran_Transact.SetSQLError("Error connecting transaction to ~""+ltran_Transact.DBMS+"~"")
RETURN FAILED
END IF
uo_ds_base luo_dw_local_security_log
uo_ds_base luo_dw_central_security_log
luo_dw_local_security_log = CREATE uo_ds_base
luo_dw_central_security_log = CREATE uo_ds_base
luo_dw_local_security_log.dataobject = "d_security_log"
luo_dw_central_security_log.dataobject = "d_security_log"
integer err1, err2, err3, err4
err3 = luo_dw_central_security_log.SetTransObject(itran)
err4 = luo_dw_local_security_log.SetTransObject(ltran_Transact)
//err1 = luo_dw_central_security_log.Retrieve() // Either retrieving or not retrieving yields only 1 insert statement
err2 = luo_dw_local_security_log.Retrieve()
integer li_CentralRowCount, li_LocalRowCount
li_CentralRowCount =luo_dw_central_security_log.RowCount() //0 Records
li_LocalRowCount = luo_dw_local_security_log.RowCount() // 19 Records
luo_dw_local_security_log.RowsCopy(1, li_LocalRowCount , Primary!, luo_dw_central_security_log, 1, Primary! )
IF luo_dw_central_security_log.Update() <> 1 THEN // Only 1 insert statement generated
itran.SetSQLError( "Unable to copy security_log data from local to central database" )
RETURN FAILED
END IF
COMMIT USING itran;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Charles:
In a quick review of your code nothing seems to be wrong
Some recommendations:
1. Add an integer variable li_check to check the return code of Rowscopy.
A succesful operation will return 1, otherwise will be -1
2. Confirm that the select statement created in both datawindows have the same order of the selected columns and that any correspondent column has the same data type in both datawindows
Maybe it's too late for this answer anyway. I hope you have solved this by now
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am actualy using datastores instead of data windows in the RowsCopy call
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.