Hello, I am starting to develop using VB.net with Microsoft Visual Studio 2008.
I have a database in Access and I?m doing a windows form application in Vb.net. From this application I want to do some operations over one table of the database.
I can to connect to the DB and using a datatable and a datadapter I catch the records from de table. After that, I add 3 new text type columns in the datatable and show it in a gridview.
I don?t have problems just here, but when I try to update the DB, the new 3 champs there aren?t in the DB design.
I don?t have any message of error. Please I need some help over that problems because I haven?t any idea about why the DB is not updated. I don?t know if there is another way to do the operations over the DB directly.
Thank
here the code:
I have a database in Access and I?m doing a windows form application in Vb.net. From this application I want to do some operations over one table of the database.
I can to connect to the DB and using a datatable and a datadapter I catch the records from de table. After that, I add 3 new text type columns in the datatable and show it in a gridview.
I don?t have problems just here, but when I try to update the DB, the new 3 champs there aren?t in the DB design.
I don?t have any message of error. Please I need some help over that problems because I haven?t any idea about why the DB is not updated. I don?t know if there is another way to do the operations over the DB directly.
Thank
here the code:
VB.NET:
Private Sub Modifica_campos()
Dim sSel = " Select * from import;"
Dim sConn As String = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & txRuta.Text & ""
Try
dt = New DataTable
da = New OleDbDataAdapter(sSel, sConn)
da.Fill(dt)
dt.Columns.Add("CODIGO_PBC", Type.GetType("System.String"))
dt.Columns.Add("PRODUCT1", Type.GetType("System.String"))
dt.Columns.Add("LOTEXACT", Type.GetType("System.String"))
dt.AcceptChanges()
da.Update(dt)
dt.AcceptChanges()
Me.dgvContenido.DataSource = dt
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub