adorecordset.open "update tablea set field1=value1 where XXX select @@rowcount" 找第0个field的值
測試時﹕ adoRs.Open "update aaa set aaapd='1' where aaapd='aaa' select @@rowcount as qq", coN If Not adoRs.EOF Then '到這里時候提示錯誤﹕執行階段錯誤'3704'Operation is not allowed whern the object is closed. Command1.Caption = ado!qq End If
adorecordset有一个属性,叫AffectedRecord之类的吧
to zzyx:沒有找到你說的屬性。我用的是VB6.0。
对不起,是connection的execute方法有一个参数AffectedRecords,可以返回你要的结果 不是用recordset建议你使用cn.Execute "update tablea set field1=value1",RowCnt 执行完毕之后 RowCnt就包含了影响的行数尽管这个方法不是按你的思路来的,但能解决你的问题, 呵呵
找第0个field的值
adoRs.Open "update aaa set aaapd='1' where aaapd='aaa' select @@rowcount as qq", coN
If Not adoRs.EOF Then '到這里時候提示錯誤﹕執行階段錯誤'3704'Operation is not allowed whern the object is closed.
Command1.Caption = ado!qq
End If
不是用recordset建议你使用cn.Execute "update tablea set field1=value1",RowCnt
执行完毕之后 RowCnt就包含了影响的行数尽管这个方法不是按你的思路来的,但能解决你的问题,
呵呵
在程序中以前见人这样做过,具体要写什么参数还不是十分清楚。
可以知道的是recordset执行完update/insert的操作之后就自动关闭了记录集。
如何操作才能得到结果,还是请高手指教。
"update tablea set field1=value1 where XXX " & vbcrlf &
"select @@rowcount",cn