Some Entrys didn't set
Posted by: as asd
Date: June 11, 2010 12:52PM

I made 5 Querys but only 3 querys got set.

My code:

public void editAccount(String oldName, String newName, String newPassword, String newEmail, int banned, String flag)
{
String banned1 = ""+banned;
String query = "UPDATE `accounts` SET login = " + "\'" + newName + "\'" + " WHERE login = " + "\'" + oldName + "\';";
String pquery = "UPDATE `accounts` SET password = " + "\'" + newPassword + "\'" + " WHERE login = " + "\'" + oldName + "\';";
String mquery = "UPDATE `accounts` SET email = " + "\'" + newEmail + "\'" + " WHERE login = " + "\'" + oldName + "\';";
String bquery = "UPDATE `accounts` SET banned = " + "\'" + banned1 + "\'" + " WHERE login = " + "\'" + oldName + "\';";
String gquery = "UPDATE `accounts` SET gm = " + "\'" + flag + "\'" + " WHERE login = " + "\'" + oldName + "\';";

try
{
if(!newPassword.equals(""))
{
s.executeUpdate(pquery);
System.out.println(pquery);
}

if(!newEmail.equals(""))
{
s.executeUpdate(mquery);
System.out.println(mquery);
}

if(!newName.equals(""))
{
s.executeUpdate(query);
System.out.println(query);
}

if(banned >=0)
{
s.executeUpdate(bquery);
System.out.println(bquery);
}

if(!flag.equals(""))
{
s.executeUpdate(gquery);
System.out.println(gquery);
}

s.close();
}catch (SQLException ex)
{
System.err.println ("Error message: " + ex.getMessage ());
System.err.println ("Error number: " + ex.getErrorCode ());
System.out.println(query);
}
}

Only the query, pquery, mquery got set but the bquery and the gquery didn't get set, don't why :/

Options: ReplyQuote


Subject
Written By
Posted
Some Entrys didn't set
June 11, 2010 12:52PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.