I can Insert table from Old_Table_Database to New_Table_Database
with this code.
Dim cmd5 As New OleDbCommand
Dim cmd6 As New OleDbCommand
cmd6 = New OleDbCommand("select * from " & "Product ", OldConn)
Dim dr6 As OleDbDataReader
dr6 = cmd6.ExecuteReader
For j As Integer = 0 To dr6.FieldCount - 1
If dr6.HasRows Then
While dr6.Read
cmd5 = NewConn.CreateCommand
cmd5.CommandText = "Insert into Product(P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15) values " & _
"('" & dr6(1) & "','" & dr6(2) & "','" & dr6(3) & "','" & dr6(4) & "','" & dr6(5) & "','" & dr6(6) & "','" & dr6(7) & "','" & dr6(8) & "','" & dr6(9) & "','" & dr6(10) & "','" & dr6(11) & "','" & dr6(12) & "','" & dr6(13) & "','" & dr6(14) & "','" & dr6(15) &"')"
cmd5.ExecuteNonQuery()
End While
End If
Next j
Then if I want copy 10 table this make me grazy
from cmd1 to cmd20
Can anyone help me to make my CopyTableToNewDatabase as simple as it can?
ex. like this
CopyTableToNewDatabase OldConn, "Product", newConn
tx