Hi Guys,
wondered if someone could help please?
in my customer form i have managed to pull in the data from the table to the right txtboxes, and i can move forwards and backwards ("happy days") but now im trying to update a record, this one has seem to thrown me, because in a different form (login) i managed to pull data from lbls and insert it into the database, i thought it would be similar, but im guessing im wrong lol
here's my code
i did try and follow another users problem (INSERT ERROR) but i couldnt follow his code clearly
any ideas?
Private Sub btn_Update_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_Update.Click
Dim con As New OleDb.OleDbConnection '"con" variable holds the Connection Object
Dim dbProvider As String 'creates provider variable
Dim dbSource As String
dbProvider = "Provider = Microsoft.ACE.OLEDB.12.0;" 'specifies the provider technology
dbSource = "Data Source = C:\Users\ComputerFirstAde\Desktop\Computer First Ade VB.net\Computer First Ade\Computer First Ade\CFA_DB.mdb" 'specifies the path to the Database
con.ConnectionString = dbProvider & dbSource 'creates the connection string
'ds.Tables.Add(dt)
con.Open()
Dim Connection As New OleDb.OleDbConnection("Provider = Microsoft.ACE.OLEDB.12.0" & _
"Data Source = C:\Users\ComputerFirstAde\Desktop\Computer First Ade VB.net\Computer First Ade\Computer First Ade\CFA_DB.mdb")
'Connection.Open()
Dim InsertCommand As New OleDb.OleDbCommand("UPDATE INTO tbl_Customers(cust_Company)" & _
"VALUES(@custCompany)", con)
InsertCommand.Parameters.Add(New OleDb.OleDbParameter("@cust_Company", Cust_CompanyTextBox.Text))
InsertCommand.ExecuteNonQuery()
con.Close()
lbl_Cust_Form.Text = "Updated Record"
End Sub