I have a DataTable that I filled from another source. I then need to save this DataTable to an Access Database. Nothing I've tried so far has worked. I've been trying to do this with an OleDbDataAdapter. The last attempt I pulled it in as a ADODB Recordset and then tried to create it:
I didn't really think it would work, but everything else I tried didn't either so what-the-heck.
-I hate Microsoft!
-Forever and always forward.
Code:
Dim Conn As New ADODB.Connection
Dim rsTable As New ADODB.Recordset
Dim strSQL As String
Try
With Conn
.ConnectionString = ProviderData
.Open()
End With
strSQL = ""
strSQL = strSQL & "Select *"
strSQL = strSQL & " From ODBC.RemoteTableName"
rsTable.Open(strSQL, Conn, CursorTypeEnum.adOpenDynamic, LockTypeEnum.adLockOptimistic)
rsTable.Close()
Return rsTable
Catch ex As Exception
MsgBox(ex.Message)
Return ex.Message
End Try
strsql = "Create Table large_tbl (Aonrvo Text(50), Lmpd Text(50))"
Dim conn2 As New OleDbConnection(ProviderData)
Dim da As New OleDbAdapter(strsql, conn2)
Dim cds As New DataSet
da.Fill(cds, rsTable, "large_tbl")
da.Update(cds, "large_tbl")
I didn't really think it would work, but everything else I tried didn't either so what-the-heck.
-I hate Microsoft!
-Forever and always forward.