I'm using VB.Net and I have a database contains two tables "Personne" and "PersonneCopy" ( Same schema as Personne [4 columns = N°, FirstName, LastName, B_Day])
I load the first table in a Datagridview all it's fine with that, here's the code:
Dim Connection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source= .\BD.mdb") Dim SqlRequete As String = "Select * From Personne" Dim Adapter As New OleDbDataAdapter(SqlRequete, Connection) Dim DataSet As New DataSet Adapter.Fill(DataSet, "Tb1") Dim DataTable As New DataTable DataTable = DataSet.Tables("Tb1") DataGridView1.DataSource = DataTable
Is there any way to add the full row that was selected from DataGridView1 to the table "PersonneCopy"?
And by the way I tried this with an other Datagridview to get the index of the row selected and it works.
Dim Index As Integer = DataGridView1.Item(0, DataGridView1.CurrentRow.Index).Value Dim SqlRequete As String = "Select * From Personne where N°=" & Index.ToString Dim Adapter As New OleDbDataAdapter(SqlRequete, Connection) Dim Ds As New DataSet Adapter.Fill(Ds, "Tb") DataGridView2.DataSource = Ds.Tables(0)
So help please, thanks in advance.