473,411 Members | 2,031 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,411 software developers and data experts.

Append Data

Hi and TIA. I have an OleDB connection to an Access db which I connect to
and place data from a table into a recordset. What I want to do is copy
this recordset to an SQL table. I have no problem connecting to the SQL
table but can't figure out how to pump the data from the recordset into the
table. Was wondering how to do it and what would be the fastest procedure.
The recordset usually consist of 20 to 100K records. Thanks very much for
your time!

--

Reggie
Nov 19 '05 #1
6 1628
Hi Reggie,

The simplest way is to loop thru recordset and create Insert sql command to
insert data into the DB. However, it’s slow especially for large records of
data. Instead, you can create middle step text data file (using StringBuilder
can improve performance), then apply bulk insert.

BTW, why do you use Recordset rather than DataTable?

HTH

Elton Wang
el********@hotmail.com

"Reggie" wrote:
Hi and TIA. I have an OleDB connection to an Access db which I connect to
and place data from a table into a recordset. What I want to do is copy
this recordset to an SQL table. I have no problem connecting to the SQL
table but can't figure out how to pump the data from the recordset into the
table. Was wondering how to do it and what would be the fastest procedure.
The recordset usually consist of 20 to 100K records. Thanks very much for
your time!

--

Reggie

Nov 19 '05 #2
Also, If I could simply loop through my dataset, grab each record and run
an Update query that would be fine. Can't figure out how to setup the loop
and grab the data. Any advice or pointers, or examples are appreciated.
Thanks again for your time!

--

Reggie
"Reggie" <NoSpam_chief123101@NoSpam_yahoo.com> wrote in message
news:4d********************@comcast.com...
Hi and TIA. I have an OleDB connection to an Access db which I connect to
and place data from a table into a recordset. What I want to do is copy
this recordset to an SQL table. I have no problem connecting to the SQL
table but can't figure out how to pump the data from the recordset into
the table. Was wondering how to do it and what would be the fastest
procedure. The recordset usually consist of 20 to 100K records. Thanks
very much for your time!

--

Reggie

Nov 19 '05 #3
Elton, I say recordset (old VB habit), but I'm actually using a dataset
filled by a MS ASccess DataTable. Would you happen to have any example of
this process cause I can't find anything on looping through the dataset. In
vb I could use do until rst.eof but doesn't seem to work on the dataset.
I'll look into your second suggestion. I came across this in my research,
but thought the looping would be faster. Goes to show you what I know.
Anyway thanks much for your time!

--

Reggie
"Elton W" <El****@discussions.microsoft.com> wrote in message
news:78**********************************@microsof t.com...
Hi Reggie,

The simplest way is to loop thru recordset and create Insert sql command
to
insert data into the DB. However, it's slow especially for large records
of
data. Instead, you can create middle step text data file (using
StringBuilder
can improve performance), then apply bulk insert.

BTW, why do you use Recordset rather than DataTable?

HTH

Elton Wang
el********@hotmail.com

"Reggie" wrote:
Hi and TIA. I have an OleDB connection to an Access db which I connect
to
and place data from a table into a recordset. What I want to do is copy
this recordset to an SQL table. I have no problem connecting to the SQL
table but can't figure out how to pump the data from the recordset into
the
table. Was wondering how to do it and what would be the fastest
procedure.
The recordset usually consist of 20 to 100K records. Thanks very much
for
your time!

--

Reggie

Nov 19 '05 #4
Actually, data is in DataTable. You should loop thru datatable:

Dim name As String
' Suppose the first table. Or you can use dataset.Tables("table_name")
For Each row As DataRow In dataset.Tables(0)
name = row("Name").ToString
' orther field

Next
Elton

"Reggie" wrote:
Elton, I say recordset (old VB habit), but I'm actually using a dataset
filled by a MS ASccess DataTable. Would you happen to have any example of
this process cause I can't find anything on looping through the dataset. In
vb I could use do until rst.eof but doesn't seem to work on the dataset.
I'll look into your second suggestion. I came across this in my research,
but thought the looping would be faster. Goes to show you what I know.
Anyway thanks much for your time!

--

Reggie
"Elton W" <El****@discussions.microsoft.com> wrote in message
news:78**********************************@microsof t.com...
Hi Reggie,

The simplest way is to loop thru recordset and create Insert sql command
to
insert data into the DB. However, it's slow especially for large records
of
data. Instead, you can create middle step text data file (using
StringBuilder
can improve performance), then apply bulk insert.

BTW, why do you use Recordset rather than DataTable?

HTH

Elton Wang
el********@hotmail.com

"Reggie" wrote:
Hi and TIA. I have an OleDB connection to an Access db which I connect
to
and place data from a table into a recordset. What I want to do is copy
this recordset to an SQL table. I have no problem connecting to the SQL
table but can't figure out how to pump the data from the recordset into
the
table. Was wondering how to do it and what would be the fastest
procedure.
The recordset usually consist of 20 to 100K records. Thanks very much
for
your time!

--

Reggie


Nov 19 '05 #5
Some thing wrong in previous post

Code should be
For Each row As DataRow In daset.Tables(0).Rows
name = row("Name").ToString
' orther field
Next

Elton
"Reggie" wrote:
Elton, I say recordset (old VB habit), but I'm actually using a dataset
filled by a MS ASccess DataTable. Would you happen to have any example of
this process cause I can't find anything on looping through the dataset. In
vb I could use do until rst.eof but doesn't seem to work on the dataset.
I'll look into your second suggestion. I came across this in my research,
but thought the looping would be faster. Goes to show you what I know.
Anyway thanks much for your time!

--

Reggie
"Elton W" <El****@discussions.microsoft.com> wrote in message
news:78**********************************@microsof t.com...
Hi Reggie,

The simplest way is to loop thru recordset and create Insert sql command
to
insert data into the DB. However, it's slow especially for large records
of
data. Instead, you can create middle step text data file (using
StringBuilder
can improve performance), then apply bulk insert.

BTW, why do you use Recordset rather than DataTable?

HTH

Elton Wang
el********@hotmail.com

"Reggie" wrote:
Hi and TIA. I have an OleDB connection to an Access db which I connect
to
and place data from a table into a recordset. What I want to do is copy
this recordset to an SQL table. I have no problem connecting to the SQL
table but can't figure out how to pump the data from the recordset into
the
table. Was wondering how to do it and what would be the fastest
procedure.
The recordset usually consist of 20 to 100K records. Thanks very much
for
your time!

--

Reggie


Nov 19 '05 #6
Elton thanks for setting me straight and for the code snippet. Very much
appreciated.

--

Reggie
"Elton W" <El****@discussions.microsoft.com> wrote in message
news:D5**********************************@microsof t.com...
Some thing wrong in previous post

Code should be
For Each row As DataRow In daset.Tables(0).Rows
name = row("Name").ToString
' orther field
Next

Elton
"Reggie" wrote:
Elton, I say recordset (old VB habit), but I'm actually using a dataset
filled by a MS ASccess DataTable. Would you happen to have any example
of
this process cause I can't find anything on looping through the dataset.
In
vb I could use do until rst.eof but doesn't seem to work on the dataset.
I'll look into your second suggestion. I came across this in my
research,
but thought the looping would be faster. Goes to show you what I know.
Anyway thanks much for your time!

--

Reggie
"Elton W" <El****@discussions.microsoft.com> wrote in message
news:78**********************************@microsof t.com...
> Hi Reggie,
>
> The simplest way is to loop thru recordset and create Insert sql
> command
> to
> insert data into the DB. However, it's slow especially for large
> records
> of
> data. Instead, you can create middle step text data file (using
> StringBuilder
> can improve performance), then apply bulk insert.
>
> BTW, why do you use Recordset rather than DataTable?
>
> HTH
>
> Elton Wang
> el********@hotmail.com
>
> "Reggie" wrote:
>
>> Hi and TIA. I have an OleDB connection to an Access db which I
>> connect
>> to
>> and place data from a table into a recordset. What I want to do is
>> copy
>> this recordset to an SQL table. I have no problem connecting to the
>> SQL
>> table but can't figure out how to pump the data from the recordset
>> into
>> the
>> table. Was wondering how to do it and what would be the fastest
>> procedure.
>> The recordset usually consist of 20 to 100K records. Thanks very much
>> for
>> your time!
>>
>> --
>>
>> Reggie
>>
>>
>>


Nov 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Jonathan Buckland | last post by:
Can someone give me an example how to append data without having to load the complete XML file. Is this possible? Jonathan
2
by: JMCN | last post by:
hi i need some advice on whether if it would be better to use an append query or an update query. here is the situation, i have linked another database table to my current database. then i...
9
by: JMCN | last post by:
hi- i have inherited an access 97 database that keeps track of the loans. i have been running into referential intergrity problems when i try to append new loans to table. first of all is a...
2
by: Danny | last post by:
I want to extract a subset of fields from one table into another the master table has many fields the subset has about half, but still many. Is there a way I can just append the master into the...
3
by: JOEP | last post by:
What do I need to do to allow an append query to post null values to records in a field of the destination table? Basically I want to allow records with null values to post to the table. The append...
1
by: David Barger | last post by:
Greetings, It appears that an Append Query I run in Access XP is randomly failing to append a field. I have payroll data being entered into a payroll database. This data is exported daily to...
5
by: Michael C via AccessMonster.com | last post by:
Hello, I have a table that I am appending 3 seperate tables into. My main problem is that each time I append the data, it simply adds to the data already there. That might sound ok, except that...
4
by: MN | last post by:
I have to import a tab-delimited text file daily into Access through a macro. All of the data needs to be added to an existing table. Some of the data already exists but may be updated by the...
4
by: Scott12345 | last post by:
Hi, here is my situation, I have a DB that tracks machine downtime (30 machines) per day. Several users will update this through the day. I created an append query that creates 30 dummy values and...
8
jinalpatel
by: jinalpatel | last post by:
I have two tables. tblClass and tblWithdrawn. On my main form(bound to tblClass) I have several data entry fields like Date withdrawn, Status (active or withdrawn) Date Classified etc. Also...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.