我收到一条消息,说明第1行附近的语法不正确。下面是我正在使用的代码:
Mysqlconn.Open()
Dim Mysqlconn As MySqlConnection
Dim COMMAND As MySqlCommand
Dim ImportDate As DateTime = DateTime.Now
COMMAND = New MySqlCommand("INSERT INTO Main([Character],[Import_Date]) VALUES(@character, @import_date)")
COMMAND.Connection = Mysqlconn
COMMAND.Parameters.AddWithValue("@character", Character.Text)
COMMAND.Parameters.AddWithValue("@import_date", ImportDate)
COMMAND.ExecuteNonQuery()
MessageBox.Show("Ore counts for " & Character.Text & " imported successfully")
答案 0 :(得分:0)
语法错误来自您字段周围的[]
。删除它们。如果要转义字段,请改用tick。
COMMAND = New MySqlCommand("INSERT INTO Main
(`Character`,`Import_Date`)
VALUES (@character, @import_date)")