Привет, я студент, я хочу знать, как исправить мою ошибку запроса вставки
Синтаксическая ошибка в операторе INSERT INTO
Что я уже пробовал:
Protected Sub btnAdd_Click(sender As Object, e As EventArgs) Dim connectionstring As String Dim connstring As String = ("PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source = C:\Users\Mthobeli Gxavu\Documents\Customer2.mdb") connectionstring = "insert into CustomerDetais,CustomerHist(CustomerNumber,CustomerName,Email,PhoneNumber,AddressNumber,Surburb,City,PostalCode,PastPurchases,CurrentOrderAmount,DatePurchase,CustomerHist.CustomerNumber) values(" & txtCustNum.Text & ",'" & txtCustName.Text & "','" & txtEmail.Text & "','" & txtNumber.Text & "','" & txtNumberZone.Text & "','" & txtSurburb.Text & "','" & txtCity.Text & "','" & txtPostalCode.Text & "','" & txtPastPurchases.Text & "'," & txtOrderAmount.Text & ",'" & txtDate.Text & "'," & txtCustNum.Text & ")" Try Using connection As New OleDbConnection(connstring) connection.Open() Dim command As New OleDb.OleDbCommand(connectionstring, connection) command.Parameters.AddWithValue("@CustomerNumber", OleDbType.Integer).Value = txtCustNum.Text() command.Parameters.AddWithValue("@CustomerName", OleDbType.VarChar).Value = txtCustName.Text() command.Parameters.AddWithValue("@Email", OleDbType.VarChar).Value = txtEmail.Text() command.Parameters.AddWithValue("@PhoneNumber", OleDbType.VarChar).Value = txtNumber.Text() command.Parameters.AddWithValue("@AddressNumber", OleDbType.VarChar).Value = txtNumberZone.Text() command.Parameters.AddWithValue("@Surburb", OleDbType.VarChar).Value = txtSurburb.Text() command.Parameters.AddWithValue("@City", OleDbType.VarChar).Value = txtCity.Text() command.Parameters.AddWithValue("@PostalCode", OleDbType.VarChar).Value = txtPostalCode.Text() command.Parameters.AddWithValue("@PastPurchases", OleDbType.VarChar).Value = txtPastPurchases.Text() command.Parameters.AddWithValue("@CurrentOrderAmount", OleDbType.Double).Value = txtOrderAmount.Text() command.Parameters.AddWithValue("@DatePurchase", OleDbType.VarChar).Value = txtDate.Text() command.ExecuteNonQuery() connection.Close() End Using Catch ex As Exception MsgBox("info not saved" & ex.ToString) End Try End Sub
PIEBALDconsult
Я плачу.