How to query SQL Db and write results into Access

  • Thread starter Thread starter levi1998
  • Start date Start date
L

levi1998

I am trying to query an SQL db and store the results of the query into
an access db. I am opening the SQL db and filling a dataset via
sqlDataAdapter.

The question is how to write this dataset into an existing table in an
access database or what other approach should I be taking to
accomplish this?

Obviously I am new at this so any help is appreciated

thx,
philip
 
Hi,

You could use SQL DTS library, which allows to transfer data from one
datasource (database) to another one.
Second way is to fill in DataSet with the data, but you would need to change
the RowState of each row to Added. Since there is no direct way to do this,
then you would need to copy your dataset into another one and it will change
the state. After all the row have Added state, you could call DataAdapter
with InsertCommand to transfer all the rows into another database
 
How should I copy the dataset? I have tried copy and clone and
neither seems to set the rowstate to 'added' so the update does
nothing when I call it.
 
Hi,

Only adding rows one-by-one actually changes row state. I have faced this
problem before. Another way to do this is to load DataSet into XmlDocument
and change it there
 
Back
Top