Hi,
I am trying to clear the rows of a bounded datagridview without clearing its dataset. I cannot clear my dataset since i m using ds.update() to update changes from my datagrid to the sql database. On every new selection from the combo box( cb_video) the details are inserted in the dgv. Few columns are to be updated by the user and the entire row is saved in the db but when the next selection is made i do not get the modified columns of my previous record ( apparently they do appear to be saved in the db) but i do get the previous records which i do not want. All the help will be appreciated
THanks :)

 Private Sub cbvideo_SelectedIndexChanged_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbvideo.SelectedIndexChanged
        Dim da1 As New SqlDataAdapter
        Dim ds1 As New DataSet
        Dim titem As String = cbvideo.SelectedItem
        Dim cmd As New SqlCommand("insert into technical_tb(tech_category,tech_item_name) values ( ' " & tcategory & " ',' " & titem & " ')", c.con)
        c.open()
        cmd.ExecuteNonQuery()
        c.close()
        da = New SqlDataAdapter("select * from technical_tb where tech_id >= (select max(tech_id)-' " & ct & " ' from technical_tb)", c.con)
        ct = ct + 1
        Dim cmdBuilder As SqlCommandBuilder = New SqlCommandBuilder(da)
        da.Fill(ds, "technical_tb")
        da.Update(ds.Tables("technical_tb"))
        ds.AcceptChanges()
        DataGridView2.DataSource = ds.Tables("technical_tb")

A quick glance at the code shows you declaring your DataAdapter and DataSet as da1 ds1 respectively, but your code is using da and ds (without the "1")...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.