Get/Set Webservice - InfoPath Dev
in

InfoPath Dev

Get/Set Webservice

Last post 11-09-2005 12:23 AM by Patrick Halstead. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 10-24-2005 11:00 AM

    Get/Set Webservice

    There is this thread I was about to answer that opened a larger question for myself.

    http://www.infopathdev.com/forums/topic.asp?TOPIC_ID=1115

    Instead of high jacking that person's thread, thought I would start a new one.

    Lets say I had two webservice GetDataSet and SetDataSet. The Get will return a dataset that will be bound to a repeating table that returns a single table from a DB. The Set method will set a dataset with all of the changes. This includes insert, updates and deletes. I can I make the SetDataSet commit all of the insert, updates and deletes in a single call to the Set webservice.

    I would be interested in knowing how someone implemented a solution to do that. Here is my point. If I were writing a .NET solution, I would call .GetChanges() on my DataSet and then execute those against the database using a DataAdapater.

    If an InfoPath form calls GetDataSet in a webservice, the dataset will be returned, the user will make some changes and then when I call SetDataSet() on the webservice. The data will be sent back up to the webservice. But how would I know exactly which rows have modified data (new, modified or deleted). My concern would be if I the GetDataSet returned 100 rows of data, the user only makes a change to a single row and then SetDataSet is called, I do not want to run 100 update statements. I just need to do one. I think I could write a solution easliy if I were writing .NET managed code in the InfoPath form. But lets say I did not want to do that.
    Jason
    http://www.k2distillery.com/
  • 10-24-2005 04:50 PM In reply to

    Well, it looks like I just had to read one of the labs I constantly tell people to read. -http://msdn.microsoft.com/office/understanding/infopath/training/default.aspx?pull=/library/en-us/odc_ip2003_tr/html/odc_inf_lab_09.asp

    Seems as if you you do:

    [WebMethod] // A method to expose on the Web service
    public DataSet ReceiveDataSet()
    {
    // get the data from the database and put it in the DataSet
    sqlDataAdapter1.Fill(dataSet11);
    // return the DataSet object with the filled data
    return dataSet11;
    }

    And then do:

    [WebMethod] // A method to expose on the Web service
    public void SubmitDataSet(DataSet ds)
    {
    // Pass the DataSet to ADO.NET; database updates automatically
    sqlDataAdapter1.Update(ds);
    }

    All of your updates, deletes, and inserts will be taken care of for you.

    Not sure why this confused me. InfoPath is doing a bunch of work for you for free.
    Jason
    http://www.k2distillery.com/
  • 11-08-2005 06:33 AM In reply to

    vt,
    i understand you because i have the same problem, sadly using the datadapter wizard to set up ur dataset and create automatically all ur routines(insert,update,delete) not is the way.
    I do the next:
    Firs i create all my object and routines by code (nothing typed).
    And for the submit data when infopath return dataset to my webservice as dataset i check in a loop each row and check a special identity field, if my field has cero i insert if not i update for example. or u can analize each row of dataset if it haschanged to apply a update. the point is that using pure code u can solve ur problem.
    I hope this help u.


    Fred Darwin Villareal
  • 11-09-2005 12:23 AM In reply to

    Another reason why we developed the Database Accelerator! :)

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.