Re: WebService DataSet

From: Val Mazur (group51a_at_hotmail.com)
Date: 09/30/04


Date: Thu, 30 Sep 2004 00:02:19 -0400

Hi,

If you just retrieved data into dataset, then all the datarows in this
dataset will have status unchanged, which means when you call Update method
of the dataadapter, it will do nothing. Dataadapter will insert only
records, where status is Added. You could achieve it using several ways. One
is to load DataSet into XML parser and change status of the datarows there.
Another way is to loop and insert records one-by-one using INSERT SQL
statement

-- 
Val Mazur
Microsoft MVP
"Strider" <Strider@discussions.microsoft.com> wrote in message 
news:FFB16A87-80D9-45BB-8D97-0096C1765F88@microsoft.com...
> In my WebService i return a DataSet. However when i try an add a table 
> from
> this dataset into the database it does not work. It is very frustrating. 
> Here
> is what im trying to do. I create a seperate dataset so i can update each
> table in the database serperately.
>
> Dim webserv As New pmlDBService
>        Dim myds As New DataSet
>        Dim mydt As New DataTable
>        myds = webserv.GetFullTables()
>        mydt = myds.Tables("Routes").Copy
>        ds1.Tables.Add(mydt)
>
> Dim da2 As New SqlDataAdapter("SELECT * FROM Routes", conn2)
>        Dim x As SqlCommandBuilder = New SqlCommandBuilder(da2)
>
>        da2.Update(ds1, "Routes") 


Relevant Pages

  • Re: Best way to copy a DataTable to a database via a DataAdapter?
    ... The procedure is to call the DataAdapter's update method. ... Create a connection object and configure its connection ... Call the .fill method of the DataAdapter and populate the DataSet with the ... since MS Access doesn't support multiple SQL statements in ExecuteNonQuery, ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: DataAdapter.Update(DataSet)
    ... for reporting. ... but calling GetChanges returns 1979 rows. ... >> changes to the db by calling the Update method of the specific ... >> are being marked as updated and the DataAdapter is trying to save those ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Need confirmation on Adapter object ??
    ... > The m_dsReel dataset is populated by the Fill method of the Adapter, ... > database we call the Update method that will execute the proper UPDATE, ... You have to pass an instance of dataset or datatable to Update method. ... One dataadapter can update one table at a time. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Question about DataTable
    ... For edits and deletes, ... > If I have a DataTable not filled into a DataSet by a DataAdapter, ... > persist changes of this DataTable to backend? ... >> I was referring to the Update method. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: How to Sinchronize a DataGridView with a database.
    ... Update method of the DataAdapter should do it for you. ... > DataGridView connected to a sql database? ... > What message shoud i send to my xxxTableAdapter or xxxDataConnector? ...
    (microsoft.public.data.ado)