四川华蓥市:VB 登陆系统 实时错误 3061 参数不足 期待是1 怎么办啊!!

来源:百度文库 编辑:杭州交通信息网 时间:2024/05/09 07:20:19
g_strsql = "select * from uname where 名称= '" & text1.Text & "' and 密码= '" & text2.Text & "'"
Set g_rs = g_db.OpenRecordset(g_strsql)

If Not g_rs.EOF Then
text1.Text = g_rs!用户名
text2.Text = g_rs!密码

谢谢!!

同意楼上的意见,也可以用这种连接来试试:

Set Coon = CreateObject("ADODB.Connection")
Connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\DB.mdb;"'数据库文件名
Coon.Open Connstr
Set rs = CreateObject("ADODB.recordset")
Sql = "select * uname where 名称= '" & Text1.Text & "' and 密码= '" & Text2.Text & "'"
rs.Open Sql, Coon, 1, 3
If Not rs.EOF Then
Text1.Text = rs("用户名")
Text2.Text = rs("密码")
End If
rs.Close

请确认 表名是 uname, 并且该表中,有 名称 和 密码两个字段