aspose file tools*
The moose likes JDBC and the fly likes is this SQL Stament correct ??? ** URGENT ** Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "is this SQL Stament correct ??? ** URGENT **" Watch "is this SQL Stament correct ??? ** URGENT **" New topic
Author

is this SQL Stament correct ??? ** URGENT **

vikas de
Ranch Hand

Joined: Feb 07, 2001
Posts: 39
hi guys...
is this SQL Statement Correct ???
int result=stmt.executeUpdate("update +tempKlasse+" set ReligionEthik='" +rfach +"' where Student like '" +studentTextField1[i].getText()+ "'");
Thanx
John Bateman
Ranch Hand

Joined: Mar 09, 2000
Posts: 320
Originally posted by vikas de:
hi guys...
is this SQL Statement Correct ???
int result=stmt.executeUpdate("update +tempKlasse+" set ReligionEthik='" +rfach +"' where Student like '" +studentTextField1[i].getText()+ "'");
Thanx

I guess being the devil's advocate I have to ask you the following questions:
1> What happens when you compile/run it?
2> What is the query suppossed to do?


SOURCE CODE should be SURROUNDED by "code" tags.
vikas de
Ranch Hand

Joined: Feb 07, 2001
Posts: 39
hi
1.)it displays " a unclosed Character literal " and ) excepted
2.)i want to update a table,where the user can decide which table he wants to update...
But i have solved the problem...
thank u anyway

[This message has been edited by vikas de (edited April 03, 2001).]
Michael Arnett
Ranch Hand

Joined: Mar 22, 2001
Posts: 65
int result=stmt.executeUpdate("update +tempKlasse+" set ReligionEthik='" +rfach +"' where Student like '" +studentTextField1[i].getText()+ "'");
Shouldn't you statement include a double quote after update.
For example ...
int result=stmt.executeUpdate("update " + tempKlasse + " set ReligionEthik='" +rfach +"' where Student like '" +studentTextField1[i].getText()+ "'");

Sun Certified Programmer for the Java 2 Platform 1.4
sanjiv chawan
Greenhorn

Joined: Apr 04, 2001
Posts: 2

No this is not correct....
The correct statement is
int result=stmt.executeUpdate(" update "+tempKlasse+" set ReligionEthik='" +rfach +"' where Student like '" +studentTextField1[i].getText()+ "'");
Bye Ashish
Originally posted by vikas de:
hi guys...
is this SQL Statement Correct ???
int result=stmt.executeUpdate("update +tempKlasse+" set ReligionEthik='" +rfach +"' where Student like '" +studentTextField1[i].getText()+ "'");
Thanx

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: is this SQL Stament correct ??? ** URGENT **