A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
video training course this week in the
JDBC and Relational Databases
JDBC SQL QUERY PROBLEM
Joined: Feb 28, 2010
Feb 28, 2010 23:40:19
I am making a student database
My database has columns as:
roll name stream year jan feb march april .... dec
now i take user input in a
page and pass to
..I take month ,attendance, and roll as input..
my sql query in the servlet is
String sql="update attendance set ? =? where roll=? "; PreparedStatement ptmt=con.prepareStatement(sql); ptmt.setString(1,month); ptmt.setString(2,attendance); ptmt.setString(3,roll); int count= ptmt.executeUpdate();
its not working ..it only works if i give the months name
String sql="update attendance set jan =? where roll=? ";
..but the month is supplied by the user !!
Joined: Jul 26, 2007
Feb 28, 2010 23:51:12
guitar maniac wrote:
Please check your
for an important administrative matter.
How to ask questions
Donate a pint, save a life!
Onff-turn it on!
Joined: Oct 13, 2005
Mar 01, 2010 03:21:02
And please avoid writing
all in CAPITAL letters.
Joined: Dec 20, 2006
Mar 01, 2010 04:50:20
update attendance set
=? where roll=?
Hi, you can't bind a column name. The first question mark is invalid.
OCUP UML fundamental and ITIL foundation
Did you see how Paul
cut 87% off of his electric heat bill with 82 watts of micro heaters
subject: JDBC SQL QUERY PROBLEM
handling quotes in sql queries
set values in a table from other
How to update a database using web forms
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015