djiceman
Member
I have been searching and reading many examples of how to do this.
Best method I found was,
mydataadapter.update(dataset)
But this does not go to the database, if I close the app and open it again, the updated information is not in the database.
Im using a mysql database and I have to code all objects(connections, adapters, datasets) as my version of vb.net does not allow to connect to non-desktop data base engines.
My code:
Is there another method to update the database.
Can anyone give me their example code for a frontend of a mysql database with basic features as read, edit and save.
Thanks
Best method I found was,
mydataadapter.update(dataset)
But this does not go to the database, if I close the app and open it again, the updated information is not in the database.
Im using a mysql database and I have to code all objects(connections, adapters, datasets) as my version of vb.net does not allow to connect to non-desktop data base engines.
My code:
Any suggestions?Dim fdCon As New OleDb.OleDbConnection("Provider=MySQLProv;Data Source=dbname;User Id=dbuser;Password=dbpass;")
Dim law As New DataSet
Dim myDataAdapter As New OleDb.OleDbDataAdapter("SELECT * FROM client", fdCon)
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
myDataAdapter.Fill(law, "client")
Dim dv As DataView = law.Tables("client").DefaultView
Me.ComboBox1.DisplayMember = "clientid"
Me.ComboBox1.DataSource = dv
Me.TextBox1.DataBindings.Add("Text", dv, "name")
DataGrid1.DataSource = law
DataGrid1.DataMember = "client"
Catch ex As Exception
MessageBox.Show(ex.Message)
fdCon.Dispose()
End Try
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
'Dim mybuilder As New OleDb.OleDbCommandBuilder(myDataAdapter)
'myDataAdapter.UpdateCommand = mybuilder.GetUpdateCommand
'The above line, gives me an error when I click this button
myDataAdapter.Update(law, "client")
End Sub
Is there another method to update the database.
Can anyone give me their example code for a frontend of a mysql database with basic features as read, edit and save.
Thanks