VB 语法错误(操作符丢失)在查询表达式用户名="内容" And where 密码=" 内容"丢失
PrivateSubCommand1_Click()DimconnAsNewADODB.ConnectionDimrsAsNewADODB.RecordsetDimsql...
Private Sub Command1_Click()
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim sql As String
conn.connectionstring = "provider=Microsoft.Jet.OLEDB.4.0;Data source=D:\厦门翱翔商品管理软件\DataBase\date.mdb"
conn.Open '连接数据库
sql = "select * from dlqx where 用户名='" & Text2.Text & "' And where 密码='" & Text1.Text & "'"
rs.Open sql, conn, adOpenKeyset, adLockReadOnly
If Text1.Text = rs.Fields("密码") And Combo1.Text = rs.Fields("用户名") Then
main.Show '(显示form1窗口)
Unload Me '(卸载当前窗口)
Else
MsgBox "密码错误!", 16, "错误"
End If
Set rs = Nothing
conn.Close
Set conn = Nothing
End Sub
都好搞几天,网上也看了很多都不行啊? 展开
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim sql As String
conn.connectionstring = "provider=Microsoft.Jet.OLEDB.4.0;Data source=D:\厦门翱翔商品管理软件\DataBase\date.mdb"
conn.Open '连接数据库
sql = "select * from dlqx where 用户名='" & Text2.Text & "' And where 密码='" & Text1.Text & "'"
rs.Open sql, conn, adOpenKeyset, adLockReadOnly
If Text1.Text = rs.Fields("密码") And Combo1.Text = rs.Fields("用户名") Then
main.Show '(显示form1窗口)
Unload Me '(卸载当前窗口)
Else
MsgBox "密码错误!", 16, "错误"
End If
Set rs = Nothing
conn.Close
Set conn = Nothing
End Sub
都好搞几天,网上也看了很多都不行啊? 展开
2个回答
展开全部
{conn.connectionstring = "provider=Microsoft.Jet.OLEDB.4.0;Data source=D:\厦门翱翔商品管理软件\DataBase\date.mdb"
conn.Open '连接数据库}
那句改为:conn.open "provider=microsoft.jet.oledb.4.0;data source=" & app.path & "\厦门翱翔商品管理软件\DataBase\date.mdb"(记住“厦门翱翔商品管理软件”文件夹要跟你现在编的文件在同一目录下)
rs.open "select * from dlqx where 用户名='" & Text2.Text & "' And where 密码='" & Text1.Text & "'",conn,adOpenKeyset, adLockBatchOptimistic(记得标点符号是英文状态下的!)
conn.Open '连接数据库}
那句改为:conn.open "provider=microsoft.jet.oledb.4.0;data source=" & app.path & "\厦门翱翔商品管理软件\DataBase\date.mdb"(记住“厦门翱翔商品管理软件”文件夹要跟你现在编的文件在同一目录下)
rs.open "select * from dlqx where 用户名='" & Text2.Text & "' And where 密码='" & Text1.Text & "'",conn,adOpenKeyset, adLockBatchOptimistic(记得标点符号是英文状态下的!)
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询