做了个登陆界面,总是出错
采用的VB+ACCESS 引用ado2.5 出错位置rs.Open sql, cn, 1, 1 提示为“from子句错误语法错误” 程序代码:
Dim cn As New ADODB.Connection Private Sub Command1_Click() Dim sql As Variant Set rs = New ADODB.Recordset sql = "select * from user where username=" & Text1.Text & "" rs.Open sql, cn, 1, 1 If rs.EOF = True Then MsgBox "该用户名不存在", vbOKCancel + 48, "提示" Else If rs("userpassword") = Trim(Text2.Text) Then main.Show Unload Me Else MsgBox "密码输入错误", vbOKCancel + 48, "错误" Text2.Text = "" Text2.SetFocus End If End If End Sub Private Sub Form_Load() Set cn = New ADODB.Connection cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\file.mdb;Persist Security Info=False" Dim rs As ADODB.Recordset End Sub
[ 本帖最后由 wangzhongda 于 2014-11-12 06:46 编辑 ]