I have a vb.net windows application with a sql backend. The form has a bindingsource and bindingnavigator. On form load I create the datatable and fill it in from a table from my database.
When i edit a record from my form, I can save it and navigating through the records I can see it is still saved, however when I close my application and reopen it the old data is there. This tells me that my issue is saving the datatable to the database. How can I do this? This is my code as an example:
Public connection As SqlConnection = New SqlConnection(ConnectString)
Public adapter As New SqlDataAdapter
Public SPISDataSet As New DataSet
Public dtMastName As New DataTable
connection = New SqlConnection(ConnectString)
Dim qryCreateTableMN As New SqlCommand("select * from MastName", connection)
adapter.SelectCommand = qryCreateTableMN
adapter.Fill(dtMastName) 'Fill the datatable from database
Private Sub btnSaveRecord_Click(sender As Object, e As EventArgs) Handles btnSaveRecord.Click
Dim CmdBuilderD As New SqlClient.SqlCommandBuilder(adapter)
adapter.UpdateCommand = CmdBuilderD.GetUpdateCommand
From what I can gather is that I should not need a seperate 'INSERT' query because I am using a bindingsource and datatable, correct?