Here is my code:
1 Dim strSQL As String
2 strSQL = "SELECT * From [user] WHERE username='" & user.Text & "' AND password = '" & password.Text & "'"
3
4 Dim MemberDataConn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; data source=" & Server.MapPath("App_Data/tournament.mdb"))
5
6 Dim MemberCommand As New OleDbCommand(strSQL, MemberDataConn)
7 MemberDataConn.Open()
8 Dim MemberDBReader As OleDbDataReader
9
10 MemberDBReader = MemberCommand.ExecuteReader()
11 If MemberDBReader.Read() Then
12 Session("UserName") = user.Text
13 Else
14 ErrorLabel.Text = "Sorry no matching user name and password is found."
15 Session("UserName") = ""
16 End If
17 MemberDBReader.Close()
18 MemberDataConn.Close()
19
20 If Session("UserName") <> "" Then Server.Transfer("youare.aspx")
The problem is at the second line. If I remove "[ ]" from the table name (user), my code just doesn't work. I looked up at different sources, they do not have the "[ ]" around their table names. Why my code needs the "[ ]" then? and what differences does it make to have or not to have "[ ]" ?
thank you for your helps