I am using the code below to append new values of a field called "symbol" in an Access table called mydata -- which is bound (via BindingSource) to a DataGridView. The update works correctly, but I need to add code at the end that will force the DataGridView to show the new field entries. Right now, I can only see the new record values if I restart the app.
Therefore, how can I force the BindingSource to reload(?) the revised table from the Access file?
Dim i, j, recordsadded As Integer
Dim buff(), inputsymbolstr, newsymbolstr(), oldsymbolstr() As String
inputsymbolstr = InputBox("Enter symbols separated by commas, e.g., ABC, BDE, FGH, ...")
newsymbolstr = Split(inputsymbolstr, ",")
Dim ConnString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=mydata.mdb"
Dim cn As New OleDbConnection(ConnString)
Dim qry As String
Dim cmd As New OleDbCommand(qry, cn)
qry = "SELECT * FROM [" & "mydata" & "] "
cmd.CommandText = qry
cmd.Connection = cn
Dim drdata As OleDbDataReader = cmd.ExecuteReader
Cnt = 0
Do While drdata.Read
Cnt += 1
ReDim Preserve oldsymbolstr(Cnt)
oldsymbolstr(Cnt) = drdata.Item("symbol")
For j = 1 To UBound(newsymbolstr)
If Cnt > 0 Then
For i = 1 To UBound(oldsymbolstr)
If oldsymbolstr(i) = newsymbolstr(j) Then GoTo nextsymb
qry = " INSERT INTO [" & "mydata" & "] ( symbol )"
qry &= " VALUES (" & "'" & newsymbolstr(j) & "'" & ")"
Dim cmd1 As New OleDbCommand(qry, cn)
recordsadded = cmd1.ExecuteNonQuery()