SqlConnection conn = new SqlConnection("server=;uid=你的用户名;password=你的密码;database=数据库名");
SqlCommand cmd = new SqlCommand("select * from table",conn);
SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
sda.Fill(ds,"table");
this.GridView1.DataSource = ds.Tables[0].DefaultView;
this.GridView1.DataBind();
asp.net数据库连接及GridView绑定
最新推荐文章于 2022-10-12 10:03:28 发布