dim re as new adodb.recordset dim db as new adodb.connection dim connstr as string private form_load() connstr = "Provider=SQLOLEDB.1;Persist Security Info=False;User & ID=sa;Initial Catalog=hoteldb;Data Source=ntserver;Connect & Timeout=30" if db.state =0 then db.open connstr re.CursorLocation = adUseClient re.Open "select 字段 from your_table"......... end if end sub private command1_click() dim i,sum as integerif re.recordcount<>0 then re.movefirst i=0 for i=0 to recordcount-1 re.delete re.update re.movenext next i sum=re.recordcount end if if sum=0 then msgbox"已成功地删除记录集中所有记录",vbOKOnly + & vbInformation, "worning" end if
dim re as new adodb.recordset dim db as new adodb.connection dim connstr as string private form_load() connstr = "Provider=SQLOLEDB.1;Persist Security Info=False;User & ID=sa;Initial Catalog=hoteldb;Data Source=ntserver;Connect & Timeout=30" if db.state =0 then db.open connstr re.CursorLocation = adUseClient re.Open "UPDATE you_table SET 字段 = Null" '如删除所有则为 're.Open "Delete * From you_table" rs.close end if end sub '没试过,你自己试吧
执行 recordset.delete adAffectAllChapters 时,为何显示: ' 实时错误 3219 操作在该内容中不被允许 ' --------------------------------------------------------- 以上是我程序中的代码,请指点:DataEnvironment1.rsCmdDstmp.Open If DataEnvironment1.rsCmdDstmp.RecordCount > 0 Then DataEv1.rsCmdDstmp.Delete adAffectAllChapters End if
dim cnn as new adodb.connection
cnn.open ""
rst.open "delete from XXXX",cnn,,,cmdtext
cnn.close
cmd.Execute
db.CursorLocation =adUseClient
db.open "..."
db.Execute "delete * from 表名 where ...."
db.Execute "Delete * From yourTable where ...."
如何一性删除它的recordset(RsCmdxxx)中的记录?
dim db as new adodb.connection
dim connstr as string
private form_load()
connstr = "Provider=SQLOLEDB.1;Persist Security Info=False;User & ID=sa;Initial Catalog=hoteldb;Data Source=ntserver;Connect & Timeout=30"
if db.state =0 then
db.open connstr
re.CursorLocation = adUseClient
re.Open "select 字段 from your_table".........
end if
end sub
private command1_click()
dim i,sum as integerif re.recordcount<>0 then
re.movefirst
i=0
for i=0 to recordcount-1
re.delete
re.update
re.movenext
next i
sum=re.recordcount
end if
if sum=0 then
msgbox"已成功地删除记录集中所有记录",vbOKOnly + & vbInformation, "worning"
end if
dim re as new adodb.recordset
dim db as new adodb.connection
dim connstr as string
private form_load()
connstr = "Provider=SQLOLEDB.1;Persist Security Info=False;User & ID=sa;Initial Catalog=hoteldb;Data Source=ntserver;Connect & Timeout=30"
if db.state =0 then
db.open connstr
re.CursorLocation = adUseClient
re.Open "UPDATE you_table SET 字段 = Null"
'如删除所有则为
're.Open "Delete * From you_table"
rs.close
end if
end sub
'没试过,你自己试吧
可以一次刪除所有記錄,因為默認為當前記錄,即adAffectCurrent
' 实时错误 3219
操作在该内容中不被允许 '
---------------------------------------------------------
以上是我程序中的代码,请指点:DataEnvironment1.rsCmdDstmp.Open
If DataEnvironment1.rsCmdDstmp.RecordCount > 0 Then
DataEv1.rsCmdDstmp.Delete adAffectAllChapters
End if
adAffectGroup 删除满足当前 Filter 属性设置的记录。使用该选项须将 Filter 属性设置为有效的预定义常量之一。 应该不支持adAffectAllChapters吧