Что-то не так с моим кодом здесь, на Visual Studio 2012. Предполагается обновить записи, которые можно найти в моей SQL Server Management Studio. Все совместимо с БД, кроме этого обновления. Пожалуйста, обратите внимание на мой код:Данные по SQL Server Management Studio не обновляются
protected void btnUpdate_Click(object sender, EventArgs e)
{
con.Open();
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
if (txtPassword.Text == "")
{
cmd.CommandText = "UPDATE Users SET [email protected], [email protected], " +
"[email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected] " +
"WHERE [email protected]";
}
else
{
cmd.CommandText = "UPDATE Users SET [email protected], [email protected], [email protected], " +
"[email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected] " +
"WHERE [email protected]";
}
cmd.Parameters.Add("@EmailAddress", SqlDbType.NVarChar).Value = txtEmail.Text;
cmd.Parameters.Add("@Password", SqlDbType.NVarChar).Value = Helper.CreateSHAHash(txtPassword.Text);
cmd.Parameters.Add("@FirstName", SqlDbType.VarChar).Value = txtFN.Text;
cmd.Parameters.Add("@LastName", SqlDbType.VarChar).Value = txtLN.Text;
//cmd.Parameters.Add("@Address", SqlDbType.NVarChar).Value = txtAddress.Text;
cmd.Parameters.Add("@Street", SqlDbType.NVarChar).Value = txtStreet.Text;
cmd.Parameters.Add("@Municipality", SqlDbType.NVarChar).Value = txtMunicipality.Text;
cmd.Parameters.Add("@City", SqlDbType.NVarChar).Value = txtCity.Text;
cmd.Parameters.Add("@ZipCode", SqlDbType.NVarChar).Value = txtZipCode.Text;
cmd.Parameters.Add("@ContactNo", SqlDbType.NVarChar).Value = txtContact.Text;
cmd.Parameters.Add("@UserID", SqlDbType.Int).Value = Session["UserID"].ToString();
if (fuImage.HasFile)
{
cmd.Parameters.Add("@Image", SqlDbType.Text).Value = "~/images/" + fuImage.FileName;
fuImage.SaveAs(Server.MapPath("~/images/" + fuImage.FileName));
}
else
{
cmd.Parameters.Add("@Image", SqlDbType.Text).Value = imgAvatar.ImageUrl;
}
Helper.AddLog(Session["UserID"].ToString(), "Update", "Updated a User");
Response.Redirect("Default.aspx");
}
protected void btnCancel_Click(object sender, EventArgs e)
{
Response.Redirect("Default.aspx");
}
Вы не выполнить команду –