How about this:
<%
String queryStr = "SELECT authorid,firstname,lastname FROM author WHERE
authorid LIKE " + authoridnum;
%>
If your authoridnum = 5, you end up with the string:
SELECT authorid,firstname,lastname FROM author WHERE authorid LIKE 5
See if that works.



--- Barbara Johnson <[EMAIL PROTECTED]> wrote:
> Hello to the JSP gurus out there.
>
>
> I am having trouble with making a query to a database with a JSP variable.
>
> I know the variable is ok because I can print it out but I can't seem to get
> the select statement
> to accept the variable. I am trying to call a particular author's record and
> if I type in the number in the
> select statement the statement works i.e.. WHERE authorid = 2   but when I
> put the variable in there is always
> an error. I have tried to use "" and '' . What else could I try. I am
> grateful for any help on this.
>
> <%
> String queryStr = "SELECT authorid,firstname,lastname FROM author WHERE
> authorid LIKE authoridnum ";
> %>
> Barb Johnson
> Instructional Programmer
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html


__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35
a year!  http://personal.mail.yahoo.com/

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to