我收到一条错误,说你的sql语法有错误,请查看与你的mysql服务器版本对应的手册,以便在''附近使用正确的语法'('001','Roldan','Matre','第1行的','马尼拉','19','男','matre @ gmail.com','099999999'
我的代码
Dim MysqlConn As MySqlConnection
Dim COMMAND As MySqlCommand
Private Sub TextBox6_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles contact.TextChanged
End Sub
Private Sub Add_Patient_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles save.Click
MysqlConn = New MySqlConnection
MysqlConn.ConnectionString =
"server=localhost;userid=root;password=theazt15><;database=database"
Dim READER As MySqlDataReader
Try
MysqlConn.Open()
Dim Query As String
Query = " INSERT INTO patient_info (Patient_Id,Surname,Firstname,MI,Address, Age, Gender, Email, Contact_No.) VALUES ('" & id.Text & "' , '" & surname.Text & "' , '" & firstname.Text & "' , '" & mi.Text & "' , '" & address.Text & "', '" & age.Text & "' , '" & gender.Text & "' , '" & email.Text & "' , '" & contact.Text & "' )"
COMMAND = New MySqlCommand(Query, MysqlConn)
READER = COMMAND.ExecuteReader
MessageBox.Show("Patient Saved")
MysqlConn.Close()
Catch ex As MySqlException
MessageBox.Show(ex.Message)
Finally
MysqlConn.Dispose()
End Try
答案 0 :(得分:-1)
。我认为在contact_no
是额外的