Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

c# DataSet WebService helllllp

Options
  • 14-08-2006 11:27pm
    #1
    Registered Users 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 Posts: 1,466 ✭✭✭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 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 Posts: 1,466 ✭✭✭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 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