如:
select Name from Student where ID='123456';如果查询出来的Name为 john,那么如何将查询出来的john 输出到页面呢?

解决方案 »

  1.   

    很多种方式的
    1、某一控件的值==john
    2、 Response.Write("john");
    3、。。下面省略
      

  2.   

    你执行一个查询语句的时候,总会用一个IList或者datatable,或其他的接受的吧。
      

  3.   


    前台,一个lable一个buttonstring strsql = ConfigurationManager.AppSettings["ConnectionString"];
            SqlConnection conn = new SqlConnection(strsql);
            string sql = "select zhzt from t_yw_zhxxb where zh='6220202020202'";
            conn.Open();
            SqlCommand command = new SqlCommand(sql, conn);
            SqlDataReader read1 = command.ExecuteReader();
            if (read1.Read())
            {
                conn.Close();
                lb1.Text = sql;
            }
            else
            {
                conn.Close();
            }
      

  4.   

    这样lable的值为select zhzt from t_yw_zhxxb where zh='6220202020202',而不是结果
      

  5.   

    lb1.Text = sql;你这样肯定是SQL语句,而不是查询的值啊.lb1.Text = read1["zh"].ToString();
      

  6.   

    哦,受教,主要还是read1对象不会用啊...
      

  7.   

    我上面那里写错了.
    应该是:
    lb1.Text = read1["zhzt"].ToString();