日期:2014-05-18 浏览次数:21101 次
SqlConnection conn = ConnectionSet.ConnectionSet.UserConnection1;
SqlDataAdapter DA = new SqlDataAdapter("", conn);
DataSet DS= new DataSet();
//你的SQL有问题。这个你要改
//具体你没有说明你表结构我无法改。
string StrSql="select kaohe.name as 姓名,kaohe.totalzpf as 自评分,kaohe.totalkspf as 复评分,kaohe.totalkpxz as 总评分 FROM kaohe,renyuan where kaohe.对应=renyuan.对应"+" kaohe.pici like '"+TextBox1.Text.ToString()+"%' and renyuan.keshi like '"+keshi+"%'";
//注:renyuan与kaohe里面必须有一个对应关系
DA.SelectCommand.CommandText=StrSql;
DA.fill(DS);
this.dataGridView1.DataSource =DS.Tables[0];