System.Data.OleDb.OleDbException:"FROM 子句中的语法错误"。



它不断告诉我FROM子句中的语法错误。有没有想过修复这个代码?我百分之百地遵循了教程,不知怎么的,这个错误一直在发生。此外,我正在使用VS2019和Microsoft Access 365。这是视觉基础.net形式。

Public Class Form1
Dim cmdlog As OleDbCommand
Dim drlog As OleDbDataReader
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
Private Sub button1_Click(sender As Object, e As EventArgs) Handles Clear.Click
End Sub
Private Sub PictureBox1_Click(sender As Object, e As EventArgs)
End Sub
Private Sub Btn_Login_Click(sender As Object, e As EventArgs) Handles Btn_Login.Click
Dim conn As New OleDbConnection("Provider= Microsoft.ACE.OLEDB.12.0;Data Source= C:UsersJaneDocumentsMYSJ GAMySJ GAbinDebugMysejahtera1.accdb")
Dim cmdlog As OleDbCommand = New OleDbCommand("Select * from user log in where [user_ID]='" & textBoxuser.Text & "' and [user_pw]='" & textBoxpw.Text & "'", conn)
conn.Open()
Dim drlog As OleDbDataReader = cmdlog.ExecuteReader
If drlog.Read() = True Then
Me.Hide()
Form4.Show()
MsgBox("login successfully")
Else
MsgBox("login failed")
End If
End Sub
End Class

我认为应该在表名中使用方括号:"从[用户登录]中选择*,其中[user_ID]=";

最新更新