You're right. Calling with http://localhost/db2.jasp?id=23 enables you to
receive a string value for variable id = "23." It looks like you want an int
value.
Integer.parseInt() should parse your string into the int var, desired.
Clearly, <% var = request.getParameter("id")%> won't work because var is
int.
But something like this should:
<% int var = Integer.parseInt( request.getParameter("id") ) %>
I haven't compiled this, but feel it is along the right line, if I
understood your question.
Phil
-----Original Message-----
From: Abhinav Nath <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Monday, November 01, 1999 11:01 AM
Subject: Parameterized, Query, With, JSP--Help!!
>Hi,
>Can any one tell how do I pass parameterized query using JSP
>I'm new tto JSP development and was developing with ASP.
>
>For example
>If I have a QueryString as http://localhost/db2.jasp?id=23
>
>Now I want to store this parameter (id)in a variable
>and Query the dtabase.
>
>Sql="select * from Users where UserId=<%=request.getParemeter("id")%>"
>isgiving error and if store it in a variable then also It's
>giving error
>
>like
><%! int var %>
><% var = request.getParaneter("id")%>
>
>Sql="selecct * from Users where User_Id = var "
>
>In this case it's taking var as a string.
>
>Please can some one send sample codes of doing this thing by passing the
>parameter both as aQueryString and by Forms.
>
>Thanks in Advance
>
>Abhinav
>
>
>
>
>______________________________________________________
>Get Your Private, Free Email at http://www.hotmail.com
>
>===========================================================================
>To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
>FAQs on JSP can be found at:
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
>
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html