468,457 Members | 1,771 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,457 developers. It's quick & easy.

table copying in ado 2.0

i need to copy in code a table from a legacy dbase III file into an access
mdb file.

both source and destination tables have the same table names, field names,
field types, & field sizes.

the access table has an index attached to it, and starts with a empty table.

i want to avoid having to create & copy row by row from the source to the
destination table

i can copy the source table into a table with the following code. i can read
the real data from that table

--------------------------
sSqlSource = "SELECT Info.* FROM Info;"
DaSource = New OleDb.OleDbDataAdapter(sSqlSource,
DBFConnedctionToSource)
Dim t As New DataTable()
DaSource.Fill(t)
--------------------------

i open the destination table with the following code, the table is empty,
but has a index attached to itself inside the mdb file
-----------------------------
sSqlDestination = "SELECT Info.* FROM Info;"
DaDestination = New OleDb.OleDbDataAdapter(sSqlDestination,
DBFConnedctionToDestination)
DsDestination.Clear()
Dim cbDestinationDa As New OleDb.OleDbCommandBuilder(DaDestination)
DaDestination.Fill(DsDestination, "Info")
-------------------------------
i don't know how to structure the 'DaDestination.Update' code

i tired 'DaDestination.Update(t)', it executes with NO ERROR, but doesn't do
anything, no data gets copied

any idea how to get the table to copy to the destination? i would appreciate
a bit of code.
thanks for any help
ray
Mar 20 '07 #1
4 1335
sSqlDestination = "SELECT Info.* FROM Info;"
DaDestination = New OleDb.OleDbDataAdapter(sSqlDestination,
DBFConnedctionToDestination)
DsDestination.Clear()
Dim cbDestinationDa As New OleDb.OleDbCommandBuilder(DaDestination)
DaDestination.Fill(DsDestination, "Info")
this isn't going to put data into your destination table. It only creates a
table called "info" in dsDestination. You have to loop through your DBF
table (the table your filled with the source data) row by row to fill
(DsDestination, "Info"). Then you can run

DaDestination.Update(DsDestination, "Info")

and that will populate the "Info" table in the Access mdb. I don't know how
to copy data from one .Net table to another .Net table except by looping.
Maybe someone knows how to do it Fill style (that would be better) - I just
only know how to do it the looping way. But the main thing is that you have
to get the data from the source .Net table to the destination .Net table in
order to get the data to your intended destination.

You can fill a .Net table from external data. And you can also pass data
between external tables if they reside on the same system as follows:

Insert Into server2.DB2.dbo.tbl2 Select * from server1.DB1.dbo.tbl1

But DBF to Access is 2 different DB systems. I don't know if the above
Insert statement would work on 2 different systems. Maybe if they are both
OleDB's. But if one is a sqlTable and one is an Ole table, then you will
need a source .Net table and a destination .Net table to act as a bridge
between the two systems.

Rich
"ray well" wrote:
i need to copy in code a table from a legacy dbase III file into an access
mdb file.

both source and destination tables have the same table names, field names,
field types, & field sizes.

the access table has an index attached to it, and starts with a empty table.

i want to avoid having to create & copy row by row from the source to the
destination table

i can copy the source table into a table with the following code. i can read
the real data from that table

--------------------------
sSqlSource = "SELECT Info.* FROM Info;"
DaSource = New OleDb.OleDbDataAdapter(sSqlSource,
DBFConnedctionToSource)
Dim t As New DataTable()
DaSource.Fill(t)
--------------------------

i open the destination table with the following code, the table is empty,
but has a index attached to itself inside the mdb file
-----------------------------
sSqlDestination = "SELECT Info.* FROM Info;"
DaDestination = New OleDb.OleDbDataAdapter(sSqlDestination,
DBFConnedctionToDestination)
DsDestination.Clear()
Dim cbDestinationDa As New OleDb.OleDbCommandBuilder(DaDestination)
DaDestination.Fill(DsDestination, "Info")
-------------------------------
i don't know how to structure the 'DaDestination.Update' code

i tired 'DaDestination.Update(t)', it executes with NO ERROR, but doesn't do
anything, no data gets copied

any idea how to get the table to copy to the destination? i would appreciate
a bit of code.
thanks for any help
ray
Mar 20 '07 #2
rich,

i did it by looping and it works, but i wanted to know if i could make it
faster. ray
Mar 20 '07 #3
dude

open up Accesss MDB and right click IMPORT?

are you some sort of frigging retard or something?

-PFC Sadr

On Mar 20, 4:02 pm, "ray well" <nos...@nospam.comwrote:
rich,

i did it by looping and it works, but i wanted to know if i could make it
faster. ray

Mar 20 '07 #4
Hi Ray,

What do you call long?
And what is than your file size

Cor

"ray well" <no****@nospam.comschreef in bericht
news:%2****************@TK2MSFTNGP06.phx.gbl...
rich,

i did it by looping and it works, but i wanted to know if i could make it
faster. ray


Mar 21 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

21 posts views Thread by Dan | last post: by
21 posts views Thread by Johan Tibell | last post: by
reply views Thread by berwiki | last post: by
2 posts views Thread by troy_lee | last post: by
1 post views Thread by subhajit12345 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.