What's not working for you? Do you get an error statement?
Are you sure that parameter "name" exists?
Where do you get the connection, "connection" ?
One style note ... It's good to avoid variable names that could possibly be
a reserved word anywhere along the line. I suggest changing String query to
String myQuery, or String nameQuery or something less generic than "query"
On 11/11/02 2:28 PM, "Jenkins, Chris" <[EMAIL PROTECTED]>
wrote:
> I'm aware this is off topic, but I couldn't' find the answer anywhere and this
> list has always helped me. I'm trying to run a wildcard search using a
> prepared statement, but I'm having zero luck. I've include the statement
> below. Any help is greatly appreciated. Note, the code below doesn't include
> a wildcard because all my attempt to use a "%" has failed.
>
> <%
>
..
> String query = "SELECT * FROM events WHERE name like ?";
> java.sql.PreparedStatement statement = connection.prepareStatement(query);
> statement.setString(1,request.getParameter("name"));
> java.sql.ResultSet RS = statement.executeQuery();
> %>
>
> If it matters anything, I'm running this on CFMX.
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com