473,224 Members | 1,968 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,224 software developers and data experts.

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 1524
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Caroline | last post by:
I need to update a table by copying a column from another table (having the same structure, but on another database), from the record having the same primary key. 1 - What is the correct...
21
by: Dan | last post by:
Hi, just ran into my first instance of a backend Access97 database not compacting. I'm getting the "MSACCESS.EXE has generated errors.." message on compact. I've narrowed it down to the largest...
3
by: sparks | last post by:
I was copying fields from one table to another. IF the var name starts with milk I change it to egg and create it in the destination table. It works fine but I want to copy the description as...
2
by: Nedu N | last post by:
Hi Techies, I am facing problem in copying content of table from a untyped dataset into to a table inside the typed dataset. I wanted to copy the data into typed dataset in order to ease the...
1
by: Mike9900 | last post by:
What is the best way to copy DataRow from one table to another table, without copying its structure, which means copying only its data. -- Mike
21
by: Johan Tibell | last post by:
I would be grateful if someone had a minute or two to review my hash table implementation. It's not yet commented but hopefully it's short and idiomatic enough to be readable. Some of the code...
0
by: berwiki | last post by:
I am trying to copy a table to another SQL 2000 Database, but I continually get errors. When I right-click, choose All-Tasks, Export-Data and go through the DTS settings, I get an 'Unspecified...
5
by: mark_aok | last post by:
Hi all, I have a situation where I have a split database. At the back end, I need to - create a new table (I will call it newTable) with the exact fields, and relationships as another table...
2
by: troy_lee | last post by:
What is the best way of copying all the records from a linked table into a replica table that is local on my computer? This is for development work at home where I can not access the main table. Is...
10
by: jacc14 | last post by:
Hi I am sure there is an easy way to do this but I have exhausted all avenues. I have some label data in a table which I want to copy to an identical table. However the first label I may only...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.