I have a vb.net windows form program that needs to insert new rows into an Access table. It's many years since I have worked with Access. I'm getting syntax errors on my Insert statement. If I remember correctly, it seems that the SQL is slightly different for Access than it is for SQL which I normally use. Here is my SQL statement:
Do I need single quotes around my values perhaps? Does anyone have an example I could look at?
Code:
Dim queryString As String = "INSERT INTO [ShippingLabel] (Order ID, Order Date, Ship To Name, Ship To Add 1, Ship To Add 2, Ship To City, Ship To State, Ship To Zip, Ship To Country, Email, Phone, AES, PO#, Ship Method, FedEx Shipping Code, Total Qty, Total value, Unit Price, FedEx Acct Number, Schedule B Number, Schedule B Description, FedEx Packaging Code) Values(" & iID & ", " & _
OrderDate & ", " & _
CStr(ShipToName) & ", " & _
CStr(ShipToAdd1) & ", " & _
CStr(ShipToAdd2) & ", " & _
CStr(dgvOrder.Rows(band.Index).Cells(5).Value).ToString.TrimEnd().Replace(",", " ") & ", " & _
CStr(dgvOrder.Rows(band.Index).Cells(6).Value).ToString.TrimEnd().Replace(",", " ") & ", " & _
CStr(dgvOrder.Rows(band.Index).Cells(7).Value).ToString.TrimEnd().Replace(",", " ") & ", " & _
CStr(ShipToCountry) & ", " & _
Email & ", " & _
Phone & ", " & _
AESNumber & ", " & _
CustomValuesXml & ", " & _
ShippingMethod & ", " & _
FedExShippingCode & ", " & _
iTotalQty & ", " & _
FormatNumber(sngExtendedAmount.ToString, 2) & ", " & _
FormatNumber(sngPrice.ToString, 2) & ", " & _
"" & ", " & _
"" & ", " & _
"" & ", " & _
"" & ", " & _
")"