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();

原文地址:https://www.cnblogs.com/crazy00/p/1631188.html