cancel
Showing results for 
Search instead for 
Did you mean: 

RowsCopy not working

Former Member
0 Kudos

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;

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member190719
Active Contributor
0 Kudos

You might also want to ask this over in the .  That's where most of the technical folks hang out.

Former Member
0 Kudos

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

Former Member
0 Kudos

I am actualy using datastores instead of data windows in the RowsCopy call

0 Kudos

Check the following line

err3 = luo_dw_central_security_log.SetTransObject(itran)

check the value of err3. It must be 1.

Also check itran transaction object is connected or not.

I hope it helps.

Regards

Azhar