主题:[讨论]关于在C#中利用双表关联的select查询语句怎么绑定dataGrid1呢
关于在C#中利用双表关联的select查询语句怎么绑定dataGrid1呢
以下是我写的程序,大家看看能不能修改下:
string str2 = String.Format("select studid as 学生编号,studscoreinfo.studno as 学生学号,studname,studscore as 学生成绩 from studscoreinfo,studinfowhere studscoreinfo.studno=studinfo.studno and studname='{0}'", textBox1.Text);
SqlDataAdapter sqladapter = new SqlDataAdapter(str2, cx.conn);
DataSet ds = new DataSet();
[color=800000] sqladapter.Fill(ds);
dataGrid1.DataSource = ds.Tables["studinfo"];[/color]
大家看看应该怎么改?!小弟急用
以下是我写的程序,大家看看能不能修改下:
string str2 = String.Format("select studid as 学生编号,studscoreinfo.studno as 学生学号,studname,studscore as 学生成绩 from studscoreinfo,studinfowhere studscoreinfo.studno=studinfo.studno and studname='{0}'", textBox1.Text);
SqlDataAdapter sqladapter = new SqlDataAdapter(str2, cx.conn);
DataSet ds = new DataSet();
[color=800000] sqladapter.Fill(ds);
dataGrid1.DataSource = ds.Tables["studinfo"];[/color]
大家看看应该怎么改?!小弟急用