开发者

Update data table on ASMX Service side

I need advice. On 开发者_StackOverflow中文版Web Service side a I hav this method :

    public DataSet GetDs(string id)
    {
        SqlConnection conn = null;
        SqlDataAdapter da = null;
        DataSet ds;
        try
        {

            string sql = "SELECT * FROM Tab1";

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

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

            da = new SqlDataAdapter(sql, conn);

            ds = new DataSet();
            da.Fill(ds, "Tab1");

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

It return dataset to client app. I client application is dataset binding in datagridview. Client can insert,update,delete row from table. If client finish his work, I want accept change in data table on web service side.

I can sent clients all dataset na update table on web service side, but I want sent only changed data. Any advice? Thank u.


You can use DataSet.GetChanges() method to retrieve a copy of the DataSet containing only changes made since last time AcceptChanges() was called.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜