Hi All,
I have a weird issue and no access to my past files to help me. I need to update the database, the code i have should work but it is telling me there is an error in my insert command. any ideas?
Code:Dim con As New OleDb.OleDbConnection Dim dbProvider As String Dim dbSource As String Dim sql As String Dim ds As New DataSet Dim da As OleDb.OleDbDataAdapter dbProvider = "PROVIDER=Microsoft.Jet.OLEDB.4.0;" dbSource = "Data Source = " & My.Settings.path & My.Settings.filename con.ConnectionString = dbProvider & dbSource con.Open() sql = "SELECT * FROM customer" da = New OleDb.OleDbDataAdapter(sql, con) da.Fill(ds, "customer") con.Close() Dim cb As New OleDb.OleDbCommandBuilder(da) Dim dsNewRow As DataRow dsNewRow = ds.Tables("customer").NewRow() dsNewRow.Item("fname") = TextBox1.Text ' update recordds dsNewRow.Item("lname") = TextBox8.Text dsNewRow.Item("streetadd") = TextBox7.Text dsNewRow.Item("suburb") = TextBox6.Text dsNewRow.Item("postcode") = TextBox5.Text dsNewRow.Item("phone") = TextBox4.Text If TextBox3.Text = "" Then dsNewRow.Item("mobile") = "na" Else dsNewRow.Item("mobile") = TextBox3.Text ' if blank make "na" End If dsNewRow.Item("email") = TextBox2.Text Dim asd As Integer Dim dsa As String dsa = ComboBox5.Text asd = dsa dsNewRow.Item("max") = asd dsNewRow.Item("proptype") = ComboBox1.Text dsNewRow.Item("pertype") = ComboBox2.Text dsNewRow.Item("rooms") = ComboBox3.Text dsNewRow.Item("invesadd") = TextBox9.Text dsNewRow.Item("ivestsub") = TextBox10.Text dsNewRow.Item("investpost") = TextBox11.Text ds.Tables("customer").Rows.Add(dsNewRow) da.Update(ds, "customer") MsgBox("Data Updated")




Reply With Quote