0

我即将完成一个类似于nike+and的网络项目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();
                    }
            }

    }

}
4

0 回答 0