SqlConnection con = new SqlConnection("server=10.200.128.120;database=KJVIEW;uid=sa;pwd=tcs54321;");
string sql = "select * from xuesheng where xuesheng.schoolid=school.schoolid";
SqlCommand com = new SqlCommand(sql,con);
SqlDataAdapter sda = new SqlDataAdapter();
sda.SelectCommand = com;
con.Open();
DataSet ds = new DataSet();
sda.Fill(ds, "xuesheng");
con.Close();
this.GridView1.DataSource = ds;
this.GridView1.DataBind();
大家帮我看看这么写为什么老提示 无法绑定由多个部分组成的标识符school.schoolid啊
string sql = "select * from xuesheng where xuesheng.schoolid=school.schoolid";
SqlCommand com = new SqlCommand(sql,con);
SqlDataAdapter sda = new SqlDataAdapter();
sda.SelectCommand = com;
con.Open();
DataSet ds = new DataSet();
sda.Fill(ds, "xuesheng");
con.Close();
this.GridView1.DataSource = ds;
this.GridView1.DataBind();
大家帮我看看这么写为什么老提示 无法绑定由多个部分组成的标识符school.schoolid啊
on xuesheng.schoolid=school.schoolid
where ...条件
sda.Fill(ds, "xuesheng"); 这个xuesheng表的数据都显示出来了 没有执行where a.schoolid=b.schoolid这个条件啊
应该算是内连接看看sql的帮助文档
里面的内连接、外连接等信息
{
SqlConnection con = new SqlConnection("server=10.200.128.120;database=KJVIEW;uid=sa;pwd=tcs54321;");
string sql = "select * from xuesheng where xuesheng.schoolid=school.schoolid";
//SqlCommand com = new SqlCommand(sql, con);
SqlDataAdapter sda = new SqlDataAdapter(sql, con); //Insus.NET changed
//sda.SelectCommand = com;
con.Open();
DataSet ds = new DataSet();
sda.Fill(ds, "xuesheng");
con.Close();
this.GridView1.DataSource = ds;
this.GridView1.DataBind();
}