update与insert
for li_n =1 to m -1 step 1
ll_sn++
ls_tables = stu_parm.text[row]
ll_tables_no = stu_parm.sgno[row]
ll_date =CDT.DBToday()
ll_time =cdt.dbNow()
insert into ho_creditcard_handle
(text,sn,date,time,tables,tables_no,
userid,Log_ncard,Log_user,deleflag)
values(:ll_text,
:ll_sn,
:ll_date,
:ll_time,
:ls_tables,
:ll_tables_no,
:casher.uid,
:Card_no,
:casher.uid,
0)
using Hotel_db.trans();
if Hotel_db.trans().sqlcode < 0 then
Rollback Using Hotel_db.trans();
MessageBox('提示','数据保存失败!')
return
end if
//end if
commit using Hotel_db.trans();
row ++
next
大家帮看看上面的跟下面的代码多次保存效果能一样吗
for li_n =1 to m -1 step 1
ll_sn ++
free.object.tables[1] = stu_parm.text[row]
free.object.tables_no[1] = stu_parm.sgno[row]
free.object.deleflag[1] = 0
free.object.userid[1] = casher.uid
free.object.Log_ncard[1] = Card_no
free.object.Log_user[1] = casher.uid
free.object.sn[1] = ll_sn
free.object.date[1] = CDT.DBToday()
free.object.time[1] = cdt.dbNow()
free.update()
IF free.Update() <> 1 then
ROLLBACK USING Hotel_DB.Trans();
Messagebox( "","保存错误!" )
return
End if
COMMIT USING Hotel_DB.Trans();
//free.
//messagebox('',1)
row ++
next
[解决办法]