hey guys, i have this question String a=textarea.getText(); CallableStatement c=connection.prepareCall("insert into database values(a)"); c.executeUpdate(); i want to update a database with the text from a text field as shown. but i this coding gives me a syntax error . y is that please tell me how to accomplish this task. thanks
Michael Zalewski
Ranch Hand
Joined: Apr 23, 2002
Posts: 168
posted
0
Since you are not returning anything from the statement, it would be better to use a PreparedStatement. But the real problem is you need to put the value in by using a '?'. You need to bind the variable 'a' to the statement, instead of just inserting the token into the SQL text.
"jasr jasr", The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp. We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please edit your profile and select a new name which meets the requirements. Thanks. Dave