
下面是 復制按鈕的代碼:
int li_i//rowscopy 回傳值變數
int li_j //dw_2 最后一行行號
int i//回圈變數
boolean b_sqlcode = false
string id,classname,sex,ages
string wid[]//定義string陣列或者dw_1上SAMPLENO列資料
int li_updata//updata 函式回傳值 變數
li_j = dw_2.rowcount() //初始化li_j dw_2最后一行
int li_dw1
li_dw1 = dw_1.rowcount()
if li_j = 0 then //dw_2如果資料 就把第一行賦給他
li_j = 1
end if
for i = 1 to li_dw1//回圈添加修改資料,如果sql資料庫有sid主鍵資料 進行修改,如果沒有主鍵資料sid 就進行添加
id = string(dw_1.object.id[i])
classname = string(dw_1.object.classname[i])
sex = string(dw_1.object.sex[i])
ages = string(dw_1.object.ages[i])
//sid = int(dw_1.object.sid[i])
//select sid into :sid from student where sid = :sid using sqlca;//查詢SAMPLENO
//if sqlca.sqlcode = 0 then
// update sid set stuname = :sname,stusxe = :sxe,stuage = :sage where stuname = :sname using sqlca;
insert into classes values (:id,:classname,:sex,:ages) using sqlca;
if sqlca.sqlcode = 0 then
commit using sqlca;
b_sqlcode = true
else
rollback using sqlca;
b_sqlcode = false
end if
//end if
if sqlca.sqlcode = 100 then//如果沒有 添加
li_i = dw_1.rowscopy( i,i,primary!,dw_2,li_j,primary!)
li_updata = dw_2.update()
if li_updata = 1 then
b_sqlcode = true
else
b_sqlcode = false
end if
dw_1.retrieve()
end if
next
if b_sqlcode = true then
Messagebox("提示","成功!")
else
MessageBox("提示","失敗!")
end if
uj5u.com熱心網友回復:
兄弟,運行到哪行代碼出錯了?什么錯誤提示?uj5u.com熱心網友回復:
每次都是 你~好激動uj5u.com熱心網友回復:
倒是沒有出錯 就是顯示復制不成功~uj5u.com熱心網友回復:
在UPDATE后看一下sqlca.sqlerrtext,這里有錯誤資訊,根據錯誤的資訊去處理轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/29871.html
標籤:數據庫相關
上一篇:[PB11.X] KODIGO最新版V4.5升級到PB12.6 出錯,求指教!
下一篇:bcp出錯,怎么也找不出錯誤!
