I am trying to update a set of data onButtonClick . i have a username , date of birth , with CurrentEmailAddress, NewEmailAdrress, ConfirmNewEmailAddress
Im trying to update all of them on a single click. I am able to update the username , but i couldnt update the date of birth and email address.
Below is my c# code: do note that myDBmanager is to execute the update and it has no problem
//SQL query
string updateSQL = "UPDATE user_profile,user_login SET ";
updateSQL += "user_profile.user_name = '" + txtUserName.Text + "', ";
updateSQL += "user_profile.user_dob = '" + txtDateOfBirth.Text + "'";
if (txtNewPassword.Text != " " && txtNewEmailAddress.Text == " ")
{
updateSQL += ", user_login.user_passw = '" + txtNewPassword.Text + "'";
}
else if (txtNewPassword.Text == " " && txtNewEmailAddress.Text != " ")
{
updateSQL += ", user_profile.user_email = '" + txtNewEmailAddress.Text + "'";
}
else if (txtNewPassword.Text != " " && txtNewEmailAddress.Text != " ")
{
updateSQL += ", user_login.user_passw = '" + txtNewPassword.Text + "',";
updateSQL += "user_profile.user_email = '" + txtNewEmailAddress.Text + "'";
}
else { }
updateSQL += " WHERE user_profile.user_profile_id = 1 ";
updateSQL += " AND user_login.user_profile_id = 1 ;";
updateSQL += Global.myDBManager.GetNewIndex();
int update = Global.myDBManager.ExecuteSql(updateSQL);
//Close connection
Global.myDBManager.Disconnect();
updateSQL += " AND user_login.user_profile_id = 1 ;";Notice the double ";" and then you addupdateSQL += Global.myDBManager.GetNewIndex();Thus, you are actually running 2 queries (?). Anyways, what does GetNewIndex() do?