我想从我的数据库中获取信息到网格视图。我有以下内容,但我不确定在何处以及如何声明数据集,因为此方法不起作用:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace ConsumeDSetService
{
public partial class _Default : System.Web.UI.Page
{
public class MyDataSet
{
public static DataSet ds;
}
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
localhost.Service1 myws = new localhost.Service1();
ds = myws.GetDataSet();
GridView1.DataSource = ds;
GridView1.DataBind();
}
}
}