代码其实很简单,WebService端代码如下:
[WebMethod]
        
public DataSet GetDataSet()
        
{
            SqlConnection conn
=new SqlConnection("server=.;uid=sa;pwd=;database=test");
            SqlDataAdapter da
=new SqlDataAdapter("select * from test2",conn);
            DataSet ds
=new DataSet();
            conn.Open();
            da.Fill(ds,
"new");
            conn.Close();
            
return ds;
        }
客户端调用代码如下:
    localhost.Service1 hw=new UseWebService1.localhost.Service1();
            
this.DataGrid1.DataSource=hw.GetDataSet().Tables[0];
            
this.DataGrid1.DataBind();
虽然我在自己机器上做没有任何问题,可是不知道在网络上的时候能承受多大的数据量.其它代码跟第一个代码相同
posted on 2007-07-02 22:08  过江  阅读(323)  评论(0编辑  收藏  举报