 |
Zhao Yu的意见:
出现这个问题的原因是你有其它控件(如TextBox)与Data控件绑定,当调用Seek方法没有找到匹配记录时,"If the Seek method fails to locate a match, the NoMatch property is set to True, and the current record is undefined."(MSDN),所以TextBox会报个错误。
解决的方法是在查询前解除TextBox与Data控件间的绑定 Set Text1.DataSource=Nothing,然后进行查询,最后再恢复绑定链接就可以了。
Frank的意见:
1.你能否试着用代码编程(DAO),使用代码编程比使用控件绑定要快很多且容易控制。
建议:真正的数据库程序是不会要数据控件去绑定的,应该有自已的代码。
dim rs as recordset
set rs=db.openrecordset(SQL 语句)
if rs.recordcount>0 then
....
else
msgbox "No match Recordset!"
end if
rs.close
2.建议使用ADO编程。ADO的速度比DAO快很多。具体ADO的应用请参考http://xufb.top263.net
此问题由Zhao Yu等回答。
附加关键字:编程, 源程序, programming, source code, Visual Basic, VB, 错误信息, error, error message, link, compile, runtime, 数据控件, data control。
|