请大家帮我看看这个代码哪里有问题!(急)
Private Sub CommandButton1_Click()
Dim cn As Object
Dim rs As Object
Dim j As String
Dim h As String
Dim strSQL As String
j = TextBox1.Value
h = TextBox2.Value
Set cn = CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.Recordset")
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Database Password=;Data Source=c:\test\date.mdb"
strSQL = "select * from user where user_name='" & j & "' and pwd='" & h & "'"
rs.Open strSQL, cn, 1, 1
If Not rs.EOF Then
MsgBox ("歡迎登陸本系統")
End If
rs.Close
End Sub
----------------------------
为什么老是说“rs.Open strSQL, cn, 1, 1”这句from子句中有语法错误,请大家帮忙看看,谢了!
[解决办法]
select * from [user] where user_name='" & j & "' and pwd='" & h & "'
[解决办法]
strSQL = "select * from [user] where [user_name]='" & j & "' and [pwd]='" & h & "'"
[解决办法]
Select * From [user] Where User_Name='"&TextBox1.Value &"' and pwd='"&TextBox2.Value &"'