Hello, i have this sqlexception errors when i try to insert data into my sql2005 from vb2008.
SqlException unhandled : Incorrect syntax near '12' and also near '3'
I am sure it is coming from the datetimepicker. However the same code is working on other forms in
the same program. i am confused. pls help!!

What does your SQL statement look like? Please post some code.

hello this is the code which gives the error "Sql Hello this is the code which is creating the error "SqlException unhandled : Incorrect Syntax near '12'   
Imports System.Data.SqlClient
Imports System.Data.SqlClient.SqlCommand
Public Con As New SqlConnection("Data Source=SALVATNBYJESUS\SERVER05;Initial Catalog=SeizedVehiclesDb;User ID=sa;Password=password")
Public qry, iqry As String
Public cmd As SqlCommand
Public dr As SqlDataReader

'SAVE NEW TRANSACTION 
' =================
            Con.Close()
            Con.Open()
            qry = "insert into ApplicationTb(inputcode,applicinputdate,declarationno,revenueliability,gphachargereceipt,shippersreceipt,paymentarrangedetails,firstofferexpirydate,applicationremarks)values('" & cboinputcode.Text & vbCrLf & _
            "'," & Date.Today & ",'" & txtdeclno.Text & "','" & txtrevenueliab.Text & "','" & txtghpareceipt.Text & "','" & txtshippersreceipt.Text & _
            "','" & txtpayarrangement.Text & "'," & dtpfirstofferEXPdate.Value.ToString & ",'" & txtapplicationremarks.Text & "')"
cmd = New SqlCommand(qry, Con)
cmd.ExecuteNonQuery()
MsgBox(" Importer Application Saved successfully", MsgBoxStyle.Information, "Save")
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.