列子:
string DataName = Request.QueryString["data"].ToString();
switch(DataName){
case "-1":
//合同付款
jh_htfk.jh_ht _htfk = new jh_htfk.jh_ht();
ListDataGrid.DataSource = _htfk.getDropListOfHT();
break;
case "1":
jh_htfk.jh_ht _htfk1 = new jh_htfk.jh_ht();
DataView thisView = new DataView(_htfk1.getDropListOfHT().Tables[0]);
ListDataGrid.DataSource = thisView;
break;
case "ht":
//合同信息
jh_ht.jh_ht jhht = new jh_ht.jh_ht();
DataView thisView1 = new DataView(jhht.get_jhht_ds_grid(Session["GCBH"].ToString()).Tables[0]);
ListDataGrid.DataSource = thisView1;
break;
}
string[] thisRQ = Request.QueryString["Rz"].ToString().Split(',');
for(int i=0;i<thisRQ.Length;i++){
BoundColumn MyAddItem = new BoundColumn();
MyAddItem.DataField = thisRQ[i].ToString().Replace(" none","");
if(thisRQ[i].ToString().Replace("none","") != thisRQ[i].ToString()){
MyAddItem.ItemStyle.CssClass = "Nones";
}
ListDataGrid.Columns.AddAt(0,MyAddItem);
ListDataGrid.DataBind();
}
string DataName = Request.QueryString["data"].ToString();
switch(DataName){
case "-1":
//合同付款
jh_htfk.jh_ht _htfk = new jh_htfk.jh_ht();
ListDataGrid.DataSource = _htfk.getDropListOfHT();
break;
case "1":
jh_htfk.jh_ht _htfk1 = new jh_htfk.jh_ht();
DataView thisView = new DataView(_htfk1.getDropListOfHT().Tables[0]);
ListDataGrid.DataSource = thisView;
break;
case "ht":
//合同信息
jh_ht.jh_ht jhht = new jh_ht.jh_ht();
DataView thisView1 = new DataView(jhht.get_jhht_ds_grid(Session["GCBH"].ToString()).Tables[0]);
ListDataGrid.DataSource = thisView1;
break;
}
string[] thisRQ = Request.QueryString["Rz"].ToString().Split(',');
for(int i=0;i<thisRQ.Length;i++){
BoundColumn MyAddItem = new BoundColumn();
MyAddItem.DataField = thisRQ[i].ToString().Replace(" none","");
if(thisRQ[i].ToString().Replace("none","") != thisRQ[i].ToString()){
MyAddItem.ItemStyle.CssClass = "Nones";
}
ListDataGrid.Columns.AddAt(0,MyAddItem);
ListDataGrid.DataBind();
}
你用一用while试一试
while(DataReader.Read())
{
Label1.Text=DataReader.Table["字段名"].ToString();
Label2.Text=DataReader.Table["字段名"].ToString();
......}
这样可以查询到所有纪录