文本框T1中取到了上一个页面传过来的值,想利用该值条件查询后数据绑定到各文本框中,可怎么都显示不出数据来.代码如下:private void Page_Load(object sender, System.EventArgs e)
{
T1.Text=Request.QueryString["id"];
if(!IsPostBack)
{
SetBind();
}
}private void SetBind()
{
OracleConnection oCon = oBase.oConnect();
string sSql = "select hb_no,godate,amound,jcamound,ryamound,bxamound from  chengke where id="+T1.Text.ToString().Trim()+"";
OracleDataReader reader = oBase.ExecuteSqlRow(sSql,oCon);
if(reader.Read())
{
 TextBox1.Text=reader["hb_no"].ToString().Trim();
 TextBox2.Text=reader["godate"].ToString().Trim();
 TextBox3.Text=reader["amound"].ToString().Trim();
 TextBox4.Text=reader["jcamound"].ToString().Trim();
 TextBox5.Text=reader["ryamound"].ToString().Trim();
 TextBox6.Text=reader["bxamound"].ToString().Trim();
}
 reader.Dispose();
 oCon.Close();

}

解决方案 »

  1.   

    reader里 没有取到值看看sql语句 连接串都对否?
      

  2.   

    Request.QueryString["id"];这个值是否为空调试一下就知道了
      

  3.   

    1.  T1.Text=Request.QueryString["id"];
    T1里的值正确吗?
    2.  select hb_no,godate,amound,jcamound,ryamound,bxamound from  chengke where id="+T1.Text.ToString().Trim()  该语句你确定没错吗?(“id”的这个取值是不是在数据库的表里面?)
      

  4.   

    OracleConnection oCon = oBase.oConnect();
    string sSql = "select hb_no,godate,amound,jcamound,ryamound,bxamound from  chengke where id="+T1.Text.ToString().Trim()+"";
    oCon.Open();//---------------------------
    OracleDataReader reader = oBase.ExecuteSqlRow(sSql,oCon);
    while(reader.Read())// --------------------
    {
     TextBox1.Text=reader["hb_no"].ToString().Trim();
     TextBox2.Text=reader["godate"].ToString().Trim();
     TextBox3.Text=reader["amound"].ToString().Trim();
     TextBox4.Text=reader["jcamound"].ToString().Trim();
     TextBox5.Text=reader["ryamound"].ToString().Trim();
     TextBox6.Text=reader["bxamound"].ToString().Trim();
    }
      

  5.   

    if(!Request.QueryString["id"].Equals(string.Empty))
       {
    T1.Text=Request.QueryString["id"];
    }
      

  6.   

    直接输出 Response.write(sSql); 看下查询语句有什么问题
      

  7.   

    T1中显示的值为15
    Request.QueryString["id"]值为15,不为空
    sSql语句结果为空
    id是number类型,用序列方式生成,数据库中已有多条数据,其中一条为:id  hb_no   godate      amound  jcamound  ryamound  bxamound15  B7908  20070602     2300      120      50          20
      

  8.   

    Response.write(sSql); 得到的结果为:
    select hb_no,godate,amound,jcamound,ryamound,bxamound from chengke where id=15
      

  9.   

    在SQL_PLUS中运行下列sql语句能够查询得到数据结果
    select hb_no,godate,amound,jcamound,ryamound,bxamound from chengke where id=15但文本框中却不显示结果,晕啊,请高手们帮忙看看,是哪出了问题,多谢!
      

  10.   

    OracleDataReader reader = oBase.ExecuteSqlRow(sSql,oCon);===========================================================你再看看oBase还有什么方法 你确定这个是你需要的么?