Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

regarding Update syntax of query

 
smitaj joshi
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
String sql="update registration set phoneno=" + phone1 + ","+ "emailid=" + emailid1 + " where name="+name1;
System.out.println(sql);
stmt=con.prepareStatement(sql);
stmt.executeUpdate()
stmt.close();
con.close();
ouput of sql-> update registration set phoneno=9860878112,emailid=smita.joshi@gmail.com where name=smita


[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'smita.joshi@gmail.com'.
 
Dany Mendez
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello smitaj joshi,

I dont't work with that DBMS, I use oracle, so this is a suggestion.

I can see that you do not limit the strings, could that be the problem?
Like so,
update registration set phoneno=9860878112,emailid='smita.joshi@gmail.com' where name='smita'

Regards
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic