473,396 Members | 1,996 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,396 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 1529
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.