Microsoft Access and VB .Net
-
Any has any idea ahy this is crashing on me giving error in the exception "Syntex error in inser into statement" Thank you The code it: Try Dim objCon As OleDbConnection objCon = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source =C:\Projects\PDFMerge_Ali\PDF_Merger\pdMerge.mdb;;Persist Security Info=False") objCon.Open() 'Create an instant of the Adapter Dim daQueue As New OleDbDataAdapter("Select * From Queue", objCon) daQueue.MissingSchemaAction = MissingSchemaAction.AddWithKey Dim dsPubs As New DataSet("Pubs") daQueue.Fill(dsPubs, "Queue") MsgBox("data loaded") ' Create a new instance of a DataTable. Dim tblQueue As DataTable tblQueue = dsPubs.Tables("Queue") Dim drCurrent As DataRow ' Obtain a new DataRow object from the DataTable. drCurrent = tblQueue.NewRow() ' Set the DataRow field values as necessary. drCurrent("ProfileName") = "test" drCurrent("ProfileDes") = "test" drCurrent("FileType") = "test" drCurrent("Merge") = "yes" drCurrent("Match") = "test" drCurrent("Printer") = "test" drCurrent("StartOnLoad") = "yes" drCurrent("PrintFiles") = "test" drCurrent("IncomingDir") = "test" drCurrent("MergeDir") = "test" drCurrent("TemDir") = "test" drCurrent("PrintDir") = "test" drCurrent("FailDir") = "test" 'Pass that new object into the Add method of the DataTable.Rows collection. tblQueue.Rows.Add(drCurrent) MsgBox("Add was successful.") Dim objCommandBuilder As New OleDbCommandBuilder(daQueue) daQueue.Update(dsPubs, "Queue") objCon.Close() MsgBox("Data Updated") Catch ex As Exception MessageBox.Show(ex.ToString) End Try:omg: Zulfikar Ali
-
Any has any idea ahy this is crashing on me giving error in the exception "Syntex error in inser into statement" Thank you The code it: Try Dim objCon As OleDbConnection objCon = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source =C:\Projects\PDFMerge_Ali\PDF_Merger\pdMerge.mdb;;Persist Security Info=False") objCon.Open() 'Create an instant of the Adapter Dim daQueue As New OleDbDataAdapter("Select * From Queue", objCon) daQueue.MissingSchemaAction = MissingSchemaAction.AddWithKey Dim dsPubs As New DataSet("Pubs") daQueue.Fill(dsPubs, "Queue") MsgBox("data loaded") ' Create a new instance of a DataTable. Dim tblQueue As DataTable tblQueue = dsPubs.Tables("Queue") Dim drCurrent As DataRow ' Obtain a new DataRow object from the DataTable. drCurrent = tblQueue.NewRow() ' Set the DataRow field values as necessary. drCurrent("ProfileName") = "test" drCurrent("ProfileDes") = "test" drCurrent("FileType") = "test" drCurrent("Merge") = "yes" drCurrent("Match") = "test" drCurrent("Printer") = "test" drCurrent("StartOnLoad") = "yes" drCurrent("PrintFiles") = "test" drCurrent("IncomingDir") = "test" drCurrent("MergeDir") = "test" drCurrent("TemDir") = "test" drCurrent("PrintDir") = "test" drCurrent("FailDir") = "test" 'Pass that new object into the Add method of the DataTable.Rows collection. tblQueue.Rows.Add(drCurrent) MsgBox("Add was successful.") Dim objCommandBuilder As New OleDbCommandBuilder(daQueue) daQueue.Update(dsPubs, "Queue") objCon.Close() MsgBox("Data Updated") Catch ex As Exception MessageBox.Show(ex.ToString) End Try:omg: Zulfikar Ali
Kindly check datatypes and data & also if the length of the data does not exceed the maximum length. VIPUL BHATT
-
Kindly check datatypes and data & also if the length of the data does not exceed the maximum length. VIPUL BHATT
Thank you for your response. I had one yes/no field and i was passing string into it. Solved the problem and thank you again.:laugh: Zulfikar Ali