I am using this code to save info written in textboxes to db .Everything seem to be fine but I don't know why it keeps throwing error saying "error in insert syntax "
the error happens while reaching update line.
Help plz
VB Code:
Private Sub Button1_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles Button1.Click Dim MySQLStr As String = "Select * From MyTab" Dim Mypath As String = Application.StartupPath & "\webdb.mdb" Dim MyCon As New OleDbConnection _ ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Mypath) Dim myadap As New OleDb.OleDbDataAdapter(MySQLStr, MyCon) Dim objCmdBld As New OleDb.OleDbCommandBuilder(myadap) Dim ds As DataSet = New DataSet() MyCon.Open() myadap.Fill(ds, "mytab") Dim MyDataRow As DataRow = ds.Tables("mytab").NewRow MyDataRow("URL") = Trim(TextBox1.Text) MyDataRow("Category") = Trim(TextBox2.Text) MyDataRow("Language") = Trim(TextBox3.Text) MyDataRow("UserName") = Trim(TextBox4.Text) MyDataRow("Password") = Trim(TextBox5.Text) MyDataRow("Comment") = Trim(TextBox6.Text) MyDataRow("last") = Trim(TextBox7.Text) ds.Tables("MyTab").Rows.Add(MyDataRow) Try myadap.Update(ds, "mytab") Catch x As Exception MsgBox(x.Message) End Try MyCon.Close() End Sub





Reply With Quote