Private Sub Command3_Click() If myre.State <> 0 Then myre.Close myre.Open "Delete * From fj Where 房间号='" & Trim(ds) & "'", cnn, adOpenDynamic, adLockPessimistic Set DataGrid1.DataSource = myre 怎么还是有错误啊
Private Sub Command3_Click() If myre.State <> 0 Then myre.Close myre.Open "SELECT * From fj Where 房间号='" & Trim(ds) & "'", cnn, adOpenDynamic, adLockPessimistic Set DataGrid1.DataSource = myre end wub'删除时 myre.delete '只要你确定一个行号就可以了。'示例:在datagrid1_keypress中删除(建议不要在_click中删除,它删除的是点击前光标所处的那一行,不是点击后的那一行) private sub datagrid1_keypress(keyascii as integer) if keyascii =13 then with myre .delete if .EOF then .movelast else .movenext end if end with end if end sub myre. if key
楼主的下述语句肯定是有问题: myre.Open "Delete * From fj Where 房间号='" & Trim(ds) & "'", cnn, adOpenDynamic, adLockPessimistic Set DataGrid1.DataSource = myre首先如果myre是一个recordset,它一般不用来执行删除操作,而是用来查询记录集。即使可以执行删除操作,那么Set DataGrid1.DataSource = myre又是什么意思?赋一个空记录集吗?
If myre.State <> 0 Then myre.Close
myre.Open "Delete * From fj Where 房间号='" & Trim(ds) & "'", cnn, adOpenDynamic, adLockPessimistic
Set DataGrid1.DataSource = myre
怎么还是有错误啊
If myre.State <> 0 Then myre.Close
myre.Open "SELECT * From fj Where 房间号='" & Trim(ds) & "'", cnn, adOpenDynamic, adLockPessimistic
Set DataGrid1.DataSource = myre
end wub'删除时
myre.delete '只要你确定一个行号就可以了。'示例:在datagrid1_keypress中删除(建议不要在_click中删除,它删除的是点击前光标所处的那一行,不是点击后的那一行)
private sub datagrid1_keypress(keyascii as integer)
if keyascii =13 then
with myre
.delete
if .EOF then
.movelast
else
.movenext
end if
end with
end if
end sub
myre.
if key
myre.Open "Delete * From fj Where 房间号='" & Trim(ds) & "'", cnn, adOpenDynamic, adLockPessimistic
Set DataGrid1.DataSource = myre首先如果myre是一个recordset,它一般不用来执行删除操作,而是用来查询记录集。即使可以执行删除操作,那么Set DataGrid1.DataSource = myre又是什么意思?赋一个空记录集吗?