Update underlying data using a DataSet and Webservices

Discussion in 'ASP .Net Web Services' started by Alex, Mar 8, 2006.

  1. Alex

    Alex Guest

    Hello,
    I am using a webservice to interact with my back end database. I have
    successfully, created a few methods which pull data in a specific format. I
    am having trouble using the update command in a DataAdapter and a newly
    modified DataSet to update the database. I have seen a few articles which
    demonstrate this, but when I try them the give me the errors, below is what I
    have tried to do, and the error I get.


    This exactly as it appeared in the article.

    [WebMethod]
    public DataSet GetCustomers()
    {
    SqlConnection con = new SqlConnection("server=servername;uid=login;
    pwd=password;database=northwind");
    SqlDataAdapter daCust = new SqlDataAdapter("Select * From
    Customers", con);
    DataSet ds = new DataSet();
    daCust.Fill(ds, "Cust");
    return ds;
    }

    [WebMethod]
    public DataSet UpdateCustomers(DataSet ds)
    {
    SqlConnection con = new
    SqlConnection("server=servername;uid=login;
    pwd=password;database=northwind");
    SqlDataAdapter daCust = new SqlDataAdapter("Select * From
    Customers", con);
    SqlCommandBuilder cbCust = new SqlCommandBuilder(daCust);
    daCust.Update(ds, "Cust");
    return ds;
    }


    The error I get is as follows;

    System.InvalidOperationException: Update unable to find
    TableMapping['tbl_DCustomers'] or DataTable 'tbl_DCustomers'.
    at System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String
    srcTable)

    Does any one have any suggestions?
     
    Alex, Mar 8, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. SMG
    Replies:
    4
    Views:
    3,552
  2. Randall Arnold
    Replies:
    0
    Views:
    861
    Randall Arnold
    Dec 22, 2005
  3. David R.

    ASP.NET 2.0 C# DataSet -> WebServices

    David R., Jan 9, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    5,783
  4. wc_chan
    Replies:
    1
    Views:
    699
    =?Utf-8?B?Q2F0YWxpbiBUb21lc2N1?=
    Dec 7, 2006
  5. Joseph

    Webservices XML, XSLT and the Dataset

    Joseph, Feb 17, 2004, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    138
    Joseph
    Feb 17, 2004
Loading...

Share This Page