Getting web service data in a local table

J

John

Hi

I am getting a dataset from a remote web method. I need to get the data in
the dataset into a local access table. Here is how far I have gone;

Dim ws As localhost.MyService
Dim ds As DataSet = ws.MyMethod
Dim da As OleDbDataAdapter

da.UpdateCommand.CommandText("SELECT srctble.* INTO [desttble]")
da.Update(ds)

What I can't figure out is a) what would be the name of the srctable if the
data is coming from a remote web method and b) what is the syntax of update
command if I want the data to go into a new table desttble in a local access
db.

Thanks

Regards
 
D

Dino Chiesa [Microsoft]

You can map from the source table to the destination table with a
DataTableMapping. (and optionally a set of DataColumnMapping 's).

The source table is the table the data has come FROM, which I presume exists
in a database that is accessible only on the server side. This table name is
contained in the dataset.

The destination table is where you want the data to go, which is MS Access.

This example shows how to copy data from one database to another using a
single dataset, and a DataTableMapping.
http://www.winisp.net/cheeso/srcview.aspx?dir=misc&file=copydata.cs

The difference for you is,
- you obtain the dataset from a webservice, not directly from a database.
- you are copying into a MS Access db, not a SQL Server db. This means
you will need to use a OleDbDataAdapter, not a SqlDataAdapter (but you
already knew that)

you can also check the reference page
http://msdn.microsoft.com/library/d...acommondataadapterclasstablemappingstopic.asp

Couple other comments:
- I am pretty sure your UpdateCommand should not be a SELECT. It should
probably be an INSERT or UPDATE.
- You will need to actually update each row in the dataset if you want the
UpdateCommand to be applied. See the example given above.


-D
 

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,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top