Ask a Question related to Coldfusion Database Access, Design and Development.
-
xcles #1
Can any1 Help?
Hi
Everytime i run the following code, i get the following error message:
SQL Exception:java.sql.SQLException:[Microsoft][ODBC Microsoft Access Driver]
Syntax error (missing operator) in query expression
if (e.getSource() == updateManager) {
String name1 = updateManagerFirstName.getText() ;
String name2 = updateManagerLastName.getText() ;
String dept = updateManagerDept.getText() ;
if (name1.equals("")) {
JOptionPane.showMessageDialog(null,"Enter Manager's First Name") ;
}
else if (name2.equals("")) {
JOptionPane.showMessageDialog(null,"Enter Manager's Second Name") ;
}
else if (dept.equals("")) {
JOptionPane.showMessageDialog(null,"Enter Manager's Department") ;
}
else {
final String url = "jdbc:odbc:EmployeeD" ;
// this is where the problem is, sql doesnt like this
sythax.......
String sSQL = "UPDATE Manager SET FirstName = '"+name1+"' WHERE"+
"FirstName = '"+nameUpdate1+"' AND SET SecondName =
'"+name2+
"WHERE SecondName = '"+nameUpdate2+"' AND SET Department =
'"+dept+
"WHERE Department = '"+departUpdate+"'" ;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection(url) ;
Statement st = con.createStatement () ;
int rec = st.executeUpdate(sSQL) ;
JOptionPane.showMessageDialog(null,"Manager Updated") ;
System.exit(0) ;
st.close();
con.close();
} // end of try statement
catch (ClassNotFoundException f ) {
JOptionPane.showMessageDialog(null,"failed to load JDBC/ODBC driver");
JOptionPane.showMessageDialog(null,"class error: " + f);
}
catch (SQLException f ) {
JOptionPane.showMessageDialog(null,"Unable to connect");
JOptionPane.showMessageDialog(null,"SQL Exception: " + f);
}
} //end of else
} // end of if upDateManager
xcles Guest
-
any1 can explain a puppeting of sprites to me ?
Hi all.. I see that many of you makes channel a puppet and then create on stage as many sprites as wanted and there's anothing in timeline right... -
mxstu #2
Re: Can any1 Help?
You're problem is your sql statement. The basic UPDATE statement has only (1)
SET and (1) WHERE Clause. For example
UPDATE yourTable
SET someTextColumn = 'someTextValue',
someNumberColumn = someNumberValue
WHERE someID = someNumericID AND
someTitle = 'some text string'
Notice how there is only (1) "set" and (1) "where" clause. See also
[url]http://www.w3schools.com/sql/sql_update.asp[/url]
mxstu Guest



Reply With Quote

