帮我看看这是什么错误
代码:using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class vote : System.Web.UI.Page
{
public System.Web.UI.WebControls.Label lbltitle;
private string voteid = "1";
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection con = DB.createConnection();
con.Open();
SqlCommand cmd = new SqlCommand("select votetitle from votemaster where voteid ='" + voteid + "'", con);
string title = Convert.ToString(cmd.ExecuteScalar);
Response.Write(title);
this.lbltitle = title;
}
}
编译器错误信息: CS0102: 类型“vote”已经包含“lbltitle”的定义
请帮帮我..小弟初学.net.谢谢了.
--------------------编程问答-------------------- 如果我把定义的那行去掉,那就说不能把string 赋给 label --------------------编程问答-------------------- public System.Web.UI.WebControls.Label lbltitle;
你控件里是不是已经添加过了???这里又声明一个是???? --------------------编程问答-------------------- lbltitle.Text --------------------编程问答-------------------- 在页面中已经有个lbltitle,不能声明一样的了
把定义删了,然后切到设计视图窗口后,双击回到CS代码,再来写 --------------------编程问答-------------------- 是给控件的Text属性赋值......
补充:.NET技术 , ASP.NET