做如下改动: 第一:sql = "delete from book where text1= '"+a+"'" 第二:rs.Open sql, con, adOpenStatic, adLockOptimistic
在MSDN的索引中输入 Open method (ADO Recordset) 看看数据库打开时参数如何设置。 你设置 adOpenKeyset, adLockOptimistic是不能用rs.RecordCount的。
With vaSpread1 .Col = 1 .Row = .ActiveRow sql = "delete from book where text1='"& .Text &"'" End With 这个地方a没有值呀为什么?if rs.state=0 then msgbox"没有最大值",,"" exit sub endif.MaxRows = rs.RecordCount 这个地方告诉我对象关闭,不允许执行应用程序的操作 ?? 是不是这两个问题
a 你把a 当成字符串了 或 sql = "delete from book where text1= '"& a &"'"
第一:sql = "delete from book where text1= '"+a+"'"
第二:rs.Open sql, con, adOpenStatic, adLockOptimistic
看看数据库打开时参数如何设置。 你设置 adOpenKeyset, adLockOptimistic是不能用rs.RecordCount的。
.Col = 1
.Row = .ActiveRow
sql = "delete from book where text1='"& .Text &"'"
End With
这个地方a没有值呀为什么?if rs.state=0 then
msgbox"没有最大值",,""
exit sub
endif.MaxRows = rs.RecordCount 这个地方告诉我对象关闭,不允许执行应用程序的操作
?? 是不是这两个问题
或
sql = "delete from book where text1= '"& a &"'"
还是不行呀
如果你的数据库没有关闭,就是你的con就没有连上数据库
把你的con连接代码贴出来看看。
con.open
endifif rs.state=1 then
rs.state=0
endif
rs.Open sql, con, adOpenKeyset, adLockOptimistic
' Command5_Click
With vaSpread1
.Col = -1
.Row = .ActiveRow
.Text = ""
.MaxRows = rs.RecordCount 这个地方告诉我对象关闭,不允许执行应用程序的操作
End With
con.open
endif
if rs.state=1 then
rs.close
endif
时就没有rs了。