Copying an Access table from one Db to another in asp.net

G

Guest

This should be simple, for someone...
I have an access database and I want to copy records from
one table in one db to another table in another Access
db. I tried creating a dataset for both and setting one
dataset equal to another, then use an update command - but
no go. Any response is welcome, and thanks!
 
D

david binney

if all you are tring to do is copy data from one source
to another you should probably be using a oledb
datareader. this is a read only record selection which
will be more efficient than instantiating a new data set
object. but it is only a read only method, so you will
not be able to alter the records. all you have to do is
create a command for the reader than execute it, and the
connection will only be open for the time that the
command is reading. here is a simple example that might
help:


//open the connection and execute the datareader.
youFirstConnection.Open();
youSecondConnection.Open();

OleDbDataReader dataReader = commandRead.ExecuteReader();

if ("everything is ok")
{
OleDbDataReader dataReader2 =
commandWrite.ExecuteReader();
}

this should give you a bit of an idea.
 
K

Kevin Spencer

How about reading the data from the table into a DataTable, then looping
through the DataTable and doing INSERTS for each row?

--
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top