Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

c# DataSet WebService helllllp

  • 14-08-2006 10:27PM
    #1
    Registered Users, Registered Users 2 Posts: 174 ✭✭


    I'm trying to pass a dataset to a client to load it up in a datagrid and let the client modify data -> pass back to web service to to update the db using a stored proc via a sql data adapter.

    Now client query works fine, pulls data back, loads up in datagrid. User modifies data calls function to pass to web service. Dataset passed contains data, arrives at the webservice and it's null :mad:

    Any help greatfully received

    sample pieces of code below.

    //member dataset of client class
    public DataSet m_dsTrades;


    //On Webservice

    public DataSet ViewTrades(int iDataSource,string strDealDate, string strAccount, int iBroker)
    {
    try
    {
    DataSet dsTrades = new DataSet("Trades");
    .
    .
    .
    .
    // passes back dataset to client(works!)

    //On Client

    localhost.Thesis wsViewThesis = new localhost.Thesis();
    m_dsTrades = wsViewThesis.ViewTrades(this.cmbDatasources.SelectedIndex,
    this.dteSelectedTradedate.Text.ToString(),
    this.cmbAccount.SelectedValue.ToString(),
    (this.cmbBroker.SelectedIndex+1));
    .
    .
    .
    Bound to to a datagrid which I use to update row then call

    //Client
    private Boolean ApproveTrades()
    {
    string strRet = null;

    try
    {
    localhost.Thesis wsThesisService = new localhost.Thesis();

    DataSet dsUpdated = new DataSet();

    dsUpdated = wsThesisService.ApproveTrades(m_dsTrades);

    //m_dsTrades populated here


    //Webservice
    [WebMethod(Description = "Approves Trades")]
    public DataSet ApproveTrades(DataSet dsTradesToApprove)
    {
    try
    .
    .
    //dsTradesToApprove now null


Comments

  • Registered Users, Registered Users 2 Posts: 1,454 ✭✭✭Smoggy


    Have u tested the dataset value bafore you pass it to the webservice

    dsUpdated = wsThesisService.ApproveTrades(m_dsTrades);

    To make sure the error doesn't lie before the webservice call ?


  • Registered Users, Registered Users 2 Posts: 174 ✭✭padlad


    I haven't tested it per se, but the tool tip is saying it's a DataSet with a Table "Trades" enclosed...and not a null object.


  • Registered Users, Registered Users 2 Posts: 1,454 ✭✭✭Smoggy


    from your code there is no valid reason why the passed dataset should be null.

    Can an event fire that clears the dataset ? or some other piece of code that clears the data ?


  • Registered Users, Registered Users 2 Posts: 174 ✭✭padlad


    tell me about it ! It was driving me mad trying to find the cause.

    Good news is that I added a string parameter just to check and see if my call was being received by the webservice and lo and behold the sting and dataset were received !!

    I don't know how or why and I've too many other things to get sorted to care at this point. I may go back and revisit in a quiet moment. Thanks for helping.


Advertisement