none
Refill Datagrid after updating different dataset

    Question

  • I have two typed Datasets both bound to a different DGV, one in form1 other in form 2.
    After changing the Data in the Grid2 on form2, I want the Grid1 in form1 to be refreshed.
    Grid1 is created by a Stored Procedure on my SQL-Server.
    For creating everything, I used drag & drop and the wizards.
    I have tried already putting the following code to the save button in the menustrip in DGV2 or putting the code into the Load_Form of form1:

    Dataset1.table.clear()
    DGV1.datasource = Nothing
    tablebindingsource.datasource = tableadapter.getdata()
    tableadapter.fill(dataset2.table)
    bindingsource.resetbindings(false)

    something else i tried was:

    Public Sub RefreshData()       

    Me.DataSet.table.Clear()       

    Me.TableAdapter.Fill(Me.DataSet.table)       

    Me.BindingSource.DataSource = Me.DataSet.table    

    Me.BindingSource.ResumeBinding()           

    End Sub

    and the last thing i tried:

    Public Sub sproc_value_transfer()        
    Dim conn As New SqlConnection("Data Source=XXX\SQLEXPRESS;Initial Catalog=a;Integrated Security=TRUE")       
    Dim strSQL As String = "dbo.storedProc1"
    conn.Open()       
    Dim da As New SqlClient.SqlDataAdapter(strSQL, conn)
    Me.DataSet.table.Clear() 
    da.Fill(Me.DataSet.table)       
    conn_veko.Close()        
    DataGridView.DataSource = Me.DataSet.table  
    End Sub
    but all this is not working. I am quite desperate. I do not get an error but DGV2 is not refilled until the program restarts.

    I would be so happy if at least anyone could give me an advise or a hint.

    cordially

    Tuesday, July 16, 2013 7:47 AM

Answers

All replies