-----Original Message-----
From: Don Coleman [mailto:[EMAIL PROTECTED]]
Sent: Friday, October 19, 2001 3:11 PM
To: '[EMAIL PROTECTED]'
Subject: DBtag problem using PreparedStatementI am having a problem with PreparedStatments and DB-tags 1.0 Beta 1
The following page (see below for full page) will not return any results when using this query
<sql:query>
SELECT sku, product_ds FROM deo_product where sku = ?
</sql:query><sql:setColumn position="1">K17</sql:setColumn>
But if I use like it works fine.
<sql:query>
SELECT sku, product_ds FROM deo_product where sku like ?
</sql:query><sql:setColumn position="1">K1%</sql:setColumn>
I'm not sure what I am doing wrong. I've tried adding quotes and using <sql:escapeSql> but I can't get this to work.
Does anyone have any suggestions?
<%@ taglib uri="http://jakarta.apache.org/taglibs/dbtags" prefix="sql" %>
<%-- open a database connection --%>
<sql:connection id="conn" jndiName="java:/comp/env/jdbc/deo"/><%-- print the rows in an HTML table --%>
<table>
<sql:preparedStatement id="stmt" conn="conn"><sql:query>
SELECT sku, product_ds FROM deo_product where sku = ?
</sql:query><sql:setColumn position="1">K17</sql:setColumn>
<%-- loop through the rows of your query --%>
<sql:resultSet id="rs">
<tr>
<td><sql:getColumn position="1"/></td>
<td><sql:getColumn position="2"/></td>
</tr>
</sql:resultSet></sql:preparedStatement>
</table><!-- close the connection -->
<sql:closeConnection conn="conn"/>
Title: DBtag problem using PreparedStatement
What's
in the sku field after the '7' ? Maybe there is space or spaces there
you're not seeing. Does it work if you use 'K17%' ? If so, that
would suggest to me that there are spaces (or something else) in that field
after the 7.
- DBtag problem using PreparedStatement Don Coleman
- RE: DBtag problem using PreparedStatement Mader, Steve
- RE: DBtag problem using PreparedStatement Don Coleman
