Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Easy SQL update question

Status
Not open for further replies.

Magnus53

Programmer
Jul 25, 2002
73
CA
Hi everybody,

I feel stupid even having to ask such a simple question but here it goes.

I'm trying to write a update statement in SQl, but it ain't working so I thought I'd let someone have a look at it because they'll find my error faster then I will.

Here is the code:

prodDesc & prodNum are variables;

java.lang.String updateString;
updateString = " UPDATE PRODUCT_TBL" +
" SET DESCRIPTION = "+ prodDesc +
" WHERE PRODUCT_NUM = "+ prodNum;

System.out.println(updateString);
java.sql.Statement statement = connection.createStatement();
statement.execute(updateString);

And this is the error I'm getting:

java.sql.SQLException: Column "TEST" not found in table at position 38. UPDATE PRODUCT_TBL SET DESCRIPTION = Test WHERE PRODUCT_NUM = 980001


thanks is advance

 
Nevermind, I finally figured it out.

But thanks for looking.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top