SQL2005问题
using System;using System.Data;
using System.Configuration;
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
{
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(@"Data Source=localhost\SQLEXPRESS; database=select; uid=sa;pwd=;");
con.Open();
//查询选举的标题
SqlCommand cmd=new SqlCommand ("select vo_title from vote where vo_id="+this.vo_id,con);
string title = Convert.ToString(cmd.ExecuteScalar());
this.Label1.Text = title;
//查询对应的投票条目
SqlCommand cmdItem = new SqlCommand("select vo_Item,vo_id from votedetails where vo_id=" + this.vo_id, con);
SqlDataReader sdr = cmdItem.ExecuteReader();
this.rdblist.DataSource = sdr;
this.rdblist.DataTextField = "vo_title";
this.rdblist.DataValueField = "vo_id";
this.rdblist.DataBind();
sdr.Close();
con.Close();
}
}
在运行上面这段代码时,出现“_vote”并不包含“vo_id”的定义
在表vote和votedetails中创建了vo_id这个字段,为什么还会出现 这样的字段,这是怎么回事,该怎样解决?