应该算是一个很简单的问题,但是有些人还是用的到的
代码比较简单,大概就是这些
protected void Page_Load(object sender, EventArgs e)
{
string constr = "Data Source=服务器;Initial Catalog=数据库;Persist Security Info=True;User ID=shwip;Password=shwip";
string sql = "SELECT APiece.Piece_PId,APiece.Piece_Id,APiece.Piece_Level FROM APiece";
SqlConnection coon = new SqlConnection(constr);
SqlDataAdapter sda = new SqlDataAdapter(sql, coon);
DataSet ds = new DataSet();
sda.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
}