如何在WindowForm中调用WebMethod服务

时间:2016-04-13 01:33:08

标签: c#

如何使用ADO.NET和Visual C#.NET

通过Web服务更新服务器数据

的WebMethod

     public void UpdateDeMo1(DataSet ds)
     {
         LayerAccess ac = new LayerAccess();
         string[] parameters = { };
         object[] values = { };
         SqlDataAdapter da = new SqlDataAdapter();
         da = ac.getDataAdapter("P_Demo", parameters, values);
         SqlCommandBuilder cb = new SqlCommandBuilder(da);
         da.Update(ds.Tables[0]);
         //return ds;
     } 

但是在调用WebMethod时会发生错误。

private void simpleButton1_Click(object sender, EventArgs e)
    {
        //ud.AutoUpdateDemo(gridControl1);
        DataTable dt = new DataTable();
        DataTable dtt = new DataTable();
        dt = (DataTable)gridControl1.DataSource;
        dtt = dt.Copy();
        DataSet ds = new DataSet("B");
        ds.Tables.Add(dtt);
        DataSet dschang = new DataSet();
        dschang = ds.Copy();
        sv.UpdateDeMo1(dschang.Copy());
    }

enter image description here

请帮帮我。

0 个答案:

没有答案