*
The moose likes JDBC and the fly likes Problem while using prepared statement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Problem while using prepared statement" Watch "Problem while using prepared statement" New topic
Author

Problem while using prepared statement

Aashima Upadhyaya
Greenhorn

Joined: Apr 23, 2011
Posts: 3
I have created the following program using prepared statement, but I am not able to go through and fetch its output accordingly.Please help.This is the program




Thanks in advance.

Aashima Upadhyay
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30138
    
150

Aashima,
Welcome to CodeRanch!

Just to make sure I'm understanding the problem correctly:

Works as expected:


Doesn't work as expected:


Can you try it with the values hardcoded in both as I have it (with the correct values of course.) I'm wondering if the variable somehow doesn't have what you expect. The JDBC looks fine.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Aashima Upadhyaya
Greenhorn

Joined: Apr 23, 2011
Posts: 3
Thanks a lot but it still doesn't works. The code doesnt gives any error at any step but the value of s1 and s2 doesnt reaches to the query



I tried inserting the value manually in place of s1 and s2 it works perfectly well. Please help me out...

love,

aashima
Ninad Kulkarni
Ranch Hand

Joined: Aug 31, 2007
Posts: 787

@Aashima

Instead of constructor use following assignment operations in action performed method at line number 45 & 46


Let us know whether values are comming or not after above change


SCJP 5.0 - JavaRanch FAQ - Java Beginners FAQ - SCJP FAQ - SCJP Mock Tests - Tutorial - JavaSE7 - JavaEE6 -Generics FAQ - JLS - JVM Spec - Java FAQs - Smart Questions
Aashima Upadhyaya
Greenhorn

Joined: Apr 23, 2011
Posts: 3
Thanks a lot Ninad Sir,it worked perfectly well for timely reply... you are a savior.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem while using prepared statement
 
Similar Threads
JDBC - Applet - Swing
Getting a problem while using database connectivity
Getting sql error [Microsoft ][odbc microsoft access driver]numeric index out of range
Calculator Problem
Can't Update Record ?