ADO.NET newbie question

G

Guest

I am new C## Ado.net user coming from a VB old style ADO environment.
Here is my situation. I have a desktop app that uses MSDE as its
database. I need the ability for a user on one computer to export some
data out of couple of tables and import them into another users computer.
This has to to happen in a disconnected way so using DTS is not an option.

From my limited ADO.net experience I hoped that I could do the following.
1)Use the SQLAdapter to query the tables from the Source computer and create
a DataSet.
2) Use the WriteXML method on the DataSet to create a XML file that contains
the data.
3)On the target computer create a dataset and use the readXML method to
import xml file that contains the data.
4)Create a SQLDataAdapter on the Target computer
5)Modify the keys on the data to avoid any primary key violations.
6) Pass the dataset with the data to be imported into SQLDatadapter using
the Update method to write to the database.

So far I have I have done steps 1-3 successfully. I have not had much
success with steps 4-6.
So has anyone does something similar to this? Do the steps make sense or
should I be doing something different? If you know of any examples of how to
do this please let me know where I can find them.

Thanks in Advance
 
R

RJ

You may want to look at the DataSet.Merge Method. Using this approach, you
don't need any export / import file. Instead if permission allows access
to Computer2_DB from Computer1, then query on local computer into a dataset.
Next query the remote computer into a different dataset. Then the Merge
method should help you combine the two. I don't know the tricks to
resolving the duplicate records issue, but I think the Merge has some
options for this. Isn't there a better way to do this with a single common
database?
 
G

Guest

Yes this might work if the app was in a connected environment. However, most
of the time this app must work in a disconnected manner so you would not have
access to the other database so it wouldnt work for us. Definintely would
need some file to transport the data.
 

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

Top