关于gridview动态绑定数据库的问题!!! 怎样动态绑定sql server2008到gridview空间在页面加载的时候就要显示在页面上请问page_load里面盖怎么写啊有谁有完整的代码啊 谢谢!~!~ 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 先搞清楚怎么绑定,把代码写到load事件中 SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=数据库名;User ID=登录名;Password=密码");//打开数据库信息自己写 con.Open(); String sql = "";//对数据库操作要查找显示的列自己写 SqlCommand cmd = new SqlCommand(sql,con); SqlDataAdapter sqld=new SqlDataAdapter(cmd); DataSet ds = new DataSet(); sqld.Fill(ds,"id"); this.GridView1.DataSource = ds.Tables["id"].DefaultView; this.GridView1.DataBind();希望对你有帮助 http://topic.csdn.net/u/20110820/00/238cba9a-eb6a-495d-a01d-e1d64b98f738.html 对Excel的xml格式比较了解的前辈请进 以前j2ee,现在要学.net? 帮我找找问题? 求.NET序号算法 请教vs.2003中,C#应用于.aspx上,能否远程连接一个acess数据库 c#win程序的sql语句问题 紧急求助,解答有分 日期格式问题 如何做到当拖动窗体中的一个控件时,窗体跟着动? 初学:如何把字体装入一个下个下拉组合框?(带部份源码) 语法问题:结构体如何通过函数改变其值 下面两行数据能够用sql语句合到一起吗?
con.Open();
String sql = "";//对数据库操作要查找显示的列自己写
SqlCommand cmd = new SqlCommand(sql,con);
SqlDataAdapter sqld=new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
sqld.Fill(ds,"id");
this.GridView1.DataSource = ds.Tables["id"].DefaultView;
this.GridView1.DataBind();
希望对你有帮助