Copying MS Access Table with code
Ok...I have done a fair amount of searching...no luck...Originally I was trying to create a new table and change the input mask with code, no such luck.
Now I am trying to copy the MS access table(hoping to keep the input mask). I have the table copying and renaming, but it fails to keep the input mask...
So far this copies and clears the table, is there anything I am missing to make it keep the input mask:confused:
The code below is what I am using:
vb Code:
Query = "SELECT * INTO [test] FROM [tblAccounts] WHERE 1=2"
comm = New OleDbCommand(Query, conn)
Try
conn.Open()
comm.ExecuteNonQuery()
Catch ex As OleDb.OleDbException
Catch ex As Exception
MsgBox(ex.Message & vbCrLf & ex.StackTrace)
Finally
If Not (conn Is Nothing) Then
comm.Dispose()
comm = Nothing
End If
End Try
Thanks for any help:D
Re: Copying MS Access Table with code
If they have Access installed then you can use the Access Object Model and execute the .TransferDatabase funciton.
This is VBA code but is easy to do in .NET
http://www.vbforums.com/showthread.php?t=409309