我即将完成一个类似于nike+
和runkeeper
的网络项目,这是一个公司制作运行设备的原型,无论如何我偶然发现了一个问题,我我收到一条显示Invalid syntax near keyword WHERE
的错误消息。我不能为我的生活弄清楚。
protected void Page_Load(object sender, EventArgs e)
{
if (Session["Email"] == null) //If user is not logged in, send to startpage
{
Response.Redirect("~/UserPages/Default.aspx");
}
else if (!IsPostBack)
{
//User info is selected from DB and put in textboxes
SqlConnection con1 = new SqlConnection(ConfigurationManager.ConnectionStrings["jaklin11ConnectionString"].ConnectionString);
SqlCommand cmd = new SqlCommand("SELECT * FROM [Users] WHERE Email = @Email", con1);
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("@Email", Session["Email"].ToString());
using (con1)
{
con1.Open();
SqlDataReader rdr = cmd.ExecuteReader();
if (rdr.Read())
{
imgProfileImageProfile.ImageUrl = rdr["ProfileImage"].ToString();
textProfileImageProfile.Text = rdr["ProfileImage"].ToString();
textFirstNameProfile.Text = rdr["FirstName"].ToString();
textLastNameProfile.Text = rdr["LastName"].ToString();
textHeightProfile.Text = rdr["Height"].ToString();
textWeightProfile.Text = rdr["Weight"].ToString();
textPasswordProfile.Text = rdr["Password"].ToString();
textBirthdateProfile.Text = rdr["Birthdate"].ToString();
textAreaCode.Text = rdr["AreaCode"].ToString();
textTown.Text = rdr["Town"].ToString();
ddlGenderProfileEdit.Text = rdr["Gender"].ToString();
}
}
}
}