At 8:52 -0800 1/28/02, Tiffany C. wrote:
>Hello,
>
>It seems that the following preparedStatement is
>changing the character ? to null. 
>
>PreparedStatement selectLocation =
>conn.prepareStatement("select location, addressLine1,
>addressLine2, addressLine3, addressLine4,
>addressLine5, addressLine6, addressLine7,
>addressLine8, addressLine9, addressLine10,
>uniqueNumber from location WHERE region = "testing?"
>order by location ASC");
>ResultSet resultLocation =
>selectLocation.executeQuery();
>
>The region "testing" will become "testingnull" before
>the preparedStatement is executed.  How can I reform
>this preparedStatement to work?

? signifies a placeholder.  Either use a Statement object instead
of a PreparedStatement object, or rewrite your code like this:

PreparedStatement selectLocation =
conn.prepareStatement("select location, addressLine1,
addressLine2, addressLine3, addressLine4,
addressLine5, addressLine6, addressLine7,
addressLine8, addressLine9, addressLine10,
uniqueNumber from location WHERE region = ?
order by location ASC");

selectLocation.setString(1, "testing?");

ResultSet resultLocation =
selectLocation.executeQuery();


>
>Thanks.
>
>Sincerely,
>Tiffany


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to