你应该看看
("Select * from login where Name='" & Trim(txtName) & "'") 中的
txtname.text 中有没有非法的字符如果txtname.text = fling'boy
那就成这样了
Select * from login where Name='fling'boy'这样就不对了.
("Select * from login where Name='" & Trim(txtName) & "'") 中的
txtname.text 中有没有非法的字符如果txtname.text = fling'boy
那就成这样了
Select * from login where Name='fling'boy'这样就不对了.
Set con = New ADODB.Connection
Set rst = New ADODB.Recordset
With con
.Provider = "Microsoft.Jet.OLEDB.4.0;Data Source=E:\vb\db.mdb;Persist Security Info=False"
.Open
End With
rst.CursorLocation = adUseClient
rst.CursorType = adOpenDynamic
rst.LockType = adLockOptimistic
rst.ActiveConnection = con
End Sub
不过这句话有一个隐含的错误,因为connection是对象,所以
这样的语句是错的,但你在运行时并没有出错,为什么呢?
因为connection有默认属性connectionstring ,
所以上一句的结果是
rst.ActiveConnection.connectionstring = con.connectring
我不知道你后面的代码能不能,如果你用adodc控件可能可以,但会再打开一个隐式的连接,不但有资源浪费,而且你可能在程序退出前这个连接一直不会关闭,后果你可以想想,如果用史recordset对象,我想是打不开的,肯定要出错.正确的是:
set rst.ActiveConnection = con说了这么多,我一分也没拿到,我多可怜5555555555555.