label 绑定数据

    SqlCommand comm;
    SqlConnection conn;
    SqlDataReader dr;

   string sonid=Request.QueryString["sonid"].ToString();
    //数据库链接语句

conn = new SqlConnection("Integrated Security=SSPI;Persist SecurityInfo=False;Initial   Catalog=xigua;Data Source=JPLS-5");
    conn.Open();
    string sql = "select * from soncity where sonid =" + Convert.ToInt32(sonid);
    comm = new SqlCommand(sql, conn);
    dr = comm.ExecuteReader();
    dr.Read();
    lbtel.Text = dr.GetValue(4).ToString();

 

posted @ 2009-12-24 10:28  liuwei0214  阅读(500)  评论(0编辑  收藏  举报