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

  • Thread starter Thread starter Guest
  • Start date Start date
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!
 
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.
 
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.
 
Back
Top