I'm setting Datagridview DataSource in Form1. In Form 2 I update those records (works fine in DB), and after updating them I want to refresh Datagridview in Form1 too.
Here is my code in Form1_Button_Click:
OracleConn() 'connection to my DB
Using cmd As New OracleCommand()
Dim SQL As String = "Select * FROM MyTable"
If Chk1.Checked = True Then
cmd.Connection = OracleConn()
cmd.CommandText = SQL
cmd.CommandType = CommandType.Text
Dim dt1 As New DataTable
Using dad As New OracleDataAdapter(SQL, OracleConn)
dad.Fill(dt1)
End Using
End if
DataGridView1.DataSource = dt1
End Using
How can I do this most easily ?