label 绑定数据
本文转自http://archive.cnblogs.com/a/1631188/
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();