Dataadapter not updating database

Rated 3.95/5 based on 513 customer reviews

Open( ) ' Create a data adapter object and set its SELECT command. To see the commands that are generated in Example 8-2, add the following lines anywhere after the declaration and assignment of the autogen variable: , etc.) in each of these statements.

Dim str Connection As String = _ "Data Source=localhost; Initial Catalog=Northwind;" _ & "Integrated Security=True" Dim cn As Sql Connection = New Sql Connection(str Connection) cn. The Sql Command Build Object can be examined to see what commands were created. To populate the datagridview, he uses the following code in the List Box1_Selected Index Changed event: Private Sub List Box1_Selected Index Changed(By Val sender As System. So, back to my question: How can I update the database when a change is made to datagridview when all I have is the bindingsource?Hopefully I've been clear enough in my description, but I'd be happy to clarify or provide any more info if you feel I've jumbled the issue all up or left something out. Always a nightmare taking over someone elses code especially if not documented.The idea is to allow a user to edit the lookup tables for the database (customer type, product list, etc). Selected Value) ' Create the binding source to fill the data grid Dim bs Data Grid As New Binding Source bs Data Grid = cls DB.When the form is loaded, the listview is populated (hard-coded) with a list of available tables. Get Recs By Param("sp Fill Grid", ary Edit Table) ' Bind the grid to the data Me.dgv1. Fill(dt Get) Catch ex As Exception ' Check for errors Msg Box(ex. Ok Only, "Error recieving data") Return Nothing End Try ' Set the data source for the bindingsource to the datatable o BS.

Leave a Reply