Thank you for your response Abhinav.
I changed my VB.Net code as you indicated in your post - see below. However, I get squiggly lines under the
OleDbCommand.command = New OleDbCommand(strSQL, dbConFromDatabase) and the error message says: Command is not a member of System.Data.OleDbCommand.
There is also a squiggly line under the statement that says:
Command.ExecuteNonQuery and the error message says: ExecuteNonQuery is not a member of String. I also added
Imports System.Data.OleDb at the top of the module.
What am I doing wrong here? I would sure like to figure this out. Any help will be greatly appreciated.
Imports System.Data.OleDb
Module Module1
Private Sub CopyTable(strFromDatabase As String, strTableName As String, strToDatabase As String)
Dim strSQL As String
Dim dbConFromDatabase As OleDb.OleDbConnection
Try
'open connection from database
dbConFromDatabase = New OleDb.OleDbConnection
dbConFromDatabase.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strToDatabase & ";Persist Security Info=False"
dbConFromDatabase.Open()
strSQL = "SELECT * INTO " & strTableName & " FROM " & strTableName & " IN '" & strFromDatabase & "';"
OleDbCommand.Command() = New OleDbCommand(strSQL, dbConFromDatabase)
Command.ExecuteNonQuery()
dbConFromDatabase.Close()
dbConFromDatabase = Nothing
Catch ex As Exception
MsgBox(Err)
End Try
End Sub
End Module