Question
December 5, 2007 at 06:31 AM
bdelacruz246

Using Visual Studio 2005

by bdelacruz246 . Updated 18 years, 11 months ago

Hi Everybody,

Does anybody know how to move an Access table from one database to another using VB in Visual Studio 2005? Below is the code that I used. Both the arrTable object array and the copyTable datatable does not work. It copies the object to the dataset but it does not save it to the other database that is the source of that dataset. Any help would be really good. I have been stuck with this code for more than a day now.

Dim table As DataTable
Dim copyTable As DataTable
?Dim arrTable(25) As Object
Dim x As Integer = 0
Dim z As Integer = 0

Dim item As ListViewItem
Dim checkedItems As ListView.CheckedListViewItemCollection = _
ListView2.CheckedItems

Try
For Each item In checkedItems
arrList(z) = item.SubItems(0).Text
z = z + 1
Next

myConnectionSource = New OleDb.OleDbConnection(strConnectionSource)
myConnectionSource.Open()

For Each table In CoaSfaDataSet2.Tables
If arrList(x) = table.TableName Then
?arrTable(x) = table.Copy()
copyTable = table.Copy()
CoasfaDataSet.Tables.Add(copyTable)
x = x + 1
z = z – 1 : If z = 0 Then Exit For
End If
Next table

myConnectionSource.Close()
myConnectionSource = Nothing

Catch
MsgBox(“Cannot proceed! {0}.” + e.ToString(), MsgBoxStyle.OkOnly, “NOT SUCCESSFUL”)
End Try

This discussion is locked

All Comments