我在我的数据库中有一个列“Klantnummer”,
我希望该值作为我的标签文本。
我怎么做?
protected string conS = "Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\Databees.mdf;Integrated Security=True;User Instance=True";
protected SqlConnection con;
protected void Page_Load(object sender, EventArgs e)
{
con = new SqlConnection(conS);
try
{
con.Open();
string q = "SELECT * FROM tblKLanten;";
SqlCommand query = new SqlCommand(q, con);
SqlDataReader dr = query.ExecuteReader();
Label1.Text = ; //I want here the value of klantnummer
con.Close();
}
catch (Exception ex)
{
Label2.Text = "Error";
}
}