0
进出口收到此错误“Textbox1的”名字时,我尝试这样做当前上下文中不存在名称'Textbox1'?
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
string connect = ConfigurationManager.ConnectionStrings["TDBSConnectionString"].ConnectionString;
string query = "SELECT news, news_date FROM [IBSI].[dbo].[ibsi.news]";
if (query != null)
{
using (SqlConnection conn = new SqlConnection(connect))
{
using (SqlCommand cmd = new SqlCommand(query, conn))
{
conn.Open();
SqlDataReader rdr = cmd.ExecuteReader();
if (rdr.HasRows)
{
while (rdr.Read())
{
Textbox1.Text=rdr["news"].ToString() ;
}
}
}
}
}
else
{
Response.Write("<p>No customer selected</p>");
}
Response.End();
}
</script>
的TextBox1中没有在当前的背景下存在的现有
<asp:TextBox ID="TextBox1" runat="server" Height="168px" TextMode="MultiLine"
Width="303px"></asp:TextBox>
出了什么问题在我的代码? ?
哦,你的权利,但现在即时通讯收到此错误XML解析错误:没有的元素中找到 位置:http://本地主机:50320 /网站/ IBSI .aspx 行号1,列1: – Bert 2012-03-15 01:41:07
可能有很多原因导致该错误,您可以按照以下建议操作:http://stackoverflow.com/questions/303066/what-could-be-causing-an -xml-parsing-error-no-element-found – 2012-03-15 01:44:31
不要调用'Response.End();' – SLaks 2012-03-15 01:47:22