db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From George Sexton <geor...@mhsoftware.com>
Subject Re: Using the WHERE clause in a ResultSet
Date Tue, 03 Nov 2015 18:10:22 GMT
If you're using JDBC, you would use a prepared statement. This isn't 
exact, but something like:

PreparedStatement ps=conn.prepareStatement("select * from table where 
field1=? and field2=?");
ps.setString(1,variable1);
ps.setString(2,variable2);
ResultSet rs=ps.executeQuery();

while (rs.next()) {
     ....
}

On 11/3/2015 10:17 AM, Bob M wrote:
> I wish to use the WHERE clause as follows:-
>
> Field 1 = current value of variable 1
> Field 2 = current value of variable 2 etc.
>
> when I use code such as
> WHERE Field1 = variable1 AND Field2 = variable2
> I get an error message saying that variable1 is not in any table in FROM
> list.........
>
> How do I correct this?
>
>
>
>
> --
> View this message in context: http://apache-database.10148.n7.nabble.com/Using-the-WHERE-clause-in-a-ResultSet-tp144994.html
> Sent from the Apache Derby Users mailing list archive at Nabble.com.
>

-- 
George Sexton
*MH Software, Inc.*
Voice: 303 438 9585
http://www.mhsoftware.com

Mime
View raw message