gridview绑定表出问题,什么都显示不了,求各位大侠帮帮忙
publicpartialclass账单:System.Web.UI.Page{SqlConnectionconn=newSqlConnection();usermyus...
public partial class 账单 : System.Web.UI.Page
{
SqlConnection conn=new SqlConnection ();
user myuser = new user();
protected void Page_Load(object sender, EventArgs e)
{
string id = Request.QueryString["id"].ToString();
conn.ConnectionString = "Data Source=.;Initial Catalog=点菜系统;Integrated Security=True";
SqlDataAdapter da = new SqlDataAdapter("select * from A" + id, conn);
DataTable ds = new DataTable();
da.Fill(ds);
this.GridView1.DataSource = ds;
this.GridView1.DataBind();
} 展开
{
SqlConnection conn=new SqlConnection ();
user myuser = new user();
protected void Page_Load(object sender, EventArgs e)
{
string id = Request.QueryString["id"].ToString();
conn.ConnectionString = "Data Source=.;Initial Catalog=点菜系统;Integrated Security=True";
SqlDataAdapter da = new SqlDataAdapter("select * from A" + id, conn);
DataTable ds = new DataTable();
da.Fill(ds);
this.GridView1.DataSource = ds;
this.GridView1.DataBind();
} 展开
3个回答
展开全部
SqlDataAdapter da = new SqlDataAdapter("select * from A" + id, conn);
这是什么意思啊, select * from A where 字段="+id吧
这是什么意思啊, select * from A where 字段="+id吧
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
gridview列的datafield域需要跟你的table的列名一致,绑定之后才会显示。或者选择自动生成列。也可以 吧、
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询