管理员.aspx
<div id="valueIntroduction" class="labelarea" runat="server"> </div>
<div class="line"></div>
管理.aspx.cs
SqlConnection NewConn = new SqlConnection(ConfigurationManager.ConnectionStrings["SoicConnection"].ConnectionString);
NewConn.Open();
SqlCommand NewComm = new SqlCommand();
SqlCommand NewComm1 = new SqlCommand();
if (Department.Items[0].Selected)
{
firstPanel.Visible = true;
myLegend.InnerText = "Informatics";
NewComm.CommandText = "getTextHeaderINFO";
NewComm.CommandType = CommandType.StoredProcedure;
NewComm.Connection = NewConn;
NewComm.CommandTimeout = 3000;
SqlDataReader results = NewComm.ExecuteReader();
while (results.Read())
{
Response.Write(results["TEXT_CONTENT"].ToString());
Label valueIntroduction = results["TEXT_CONTENT"];
}
}
我正在尝试的是从数据库中获取值并将其加载到标签中。我是 .net 和 stackoverflow 的新手。对不起,如果我不知道如何正确使用这个论坛。