刚才打字错了许多,更正一下
//tranASA是asa事务,自己声明
Datastore lds_source,lds_target
String ls_create, ls_err
ls_create = sqlca.SyntaxFromSQL("select dm, mc from 表", "type(style=grid)", ls_err)
If Len(ls_err) > 0 Then
MessageBox("错误", "sql语句错误!")
Return
End If
lds_source = create Datastore
lds_source.Create(ls_create, ls_err)
If Len(ls_err) > 0 Then
Destroy lds_source
MessageBox("错误", "sql语句错误!")
Return
End If
lds_target = create Datastore
If Len(ls_err) > 0 Then
Destroy lds_target
MessageBox("错误", "sql语句错误!")
Return
End If
lds_target.SetTransObject(tranAsa)
lds_target.object.datawindow.data = lds_source.object.datawindow.data
If lds_target.Update() = 1 Then
Commit Using tranAsa;
Else
Rollback Using tranAsa;
MessageBox("失败", "保存失败!")
End If
datastroe实现不同数据库间传输数据的例子
Datastore lds_source
String ls_create, ls_err
ls_create = sqlca.SyntaxFromSQL("select dm, mc from 表", "type(style=grid)", ls_err)
If Len(ls_err) > 0 Then
MessageBox("错误", "sql语句错误!")
Return
End If
lds_source = create Datastore
lds_source.Create(ls_create, ls_err)
If Len(ls_err) > 0 Then
Destroy lds_source
MessageBox("错误", "sql语句错误!")
Return
End If
lds_taget = create Datastore
If Len(ls_err) > 0 Then
Destroy lds_taget
MessageBox("错误", "sql语句错误!")
Return
End If
lsd_target.SetTransObject(tranAsa)
lsd_target.object.datawindow.data = lsd_source.object.datawindow.data
If lds_target.Update() = 1 Then
Commit Using tr_code_sqlca;
Else
Rollback Using tr_code_sqlca;
MessageBox("失败", "保存失败!")
End If