tags:

views:

24

answers:

1

I am begginer with ADO.NET , I try update table with DataSet. O client side I have dataset with one table. I send this dataset on service side (it is ASP.NET Web Service). On Service side I try update table in database, but it dont 't work.

public bool Update(DataSet ds) {

    SqlConnection conn = null;
    SqlDataAdapter da = null;
    SqlCommand cmd = null;
    try
    {

        string sql = "UPDATE * FROM Tab1";

        string connStr = WebConfigurationManager.ConnectionStrings["Employees"].ConnectionString;

        conn = new SqlConnection(connStr);
        conn.Open();

        cmd=new SqlCommand(sql,conn);

        da = new SqlDataAdapter(sql, conn);
        da.UpdateCommand = cmd;

        da.Update(ds.Tables[0]);
        return true;

    }
    catch (Exception ex)
    {
        throw ex;
    }
    finally
    {
        if (conn != null)
            conn.Close();
        if (da != null)
            da.Dispose();
    }
}

Where can be problem?

+1  A: 

It is better to look how really ADO.Net dataset works. http://support.microsoft.com/kb/308507

Wonde

related questions