Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you pass parameters to an ASP page

Status
Not open for further replies.

DougP

MIS
Dec 13, 1999
5,985
US
here is my code:<br>-------------------------------------------<br>&lt;%@ Language=VBScript %&gt; <br>&lt;html&gt;<br><br>&lt;head&gt;<br>&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=windows-1252&quot;&gt;<br>&lt;meta name=&quot;GENERATOR&quot; content=&quot;Microsoft FrontPage 4.0&quot;&gt;<br>&lt;meta name=&quot;ProgId&quot; content=&quot;FrontPage.Editor.Document&quot;&gt;<br>&lt;title&gt;New Page 2&lt;/title&gt;<br>&lt;/head&gt;<br><br>&lt;body&gt;<br>&lt;%&nbsp;&nbsp;Response.Write(&quot;These records are pulled from an MS Access database&quot;)&nbsp;&nbsp;%&gt; <br>&lt;%<br>Set Conn = Server.CreateObject(&quot;ADODB.Connection&quot;)<br>Conn.Open &quot;driver=SQL Server;server=<A HREF=" TARGET="_new"> RS = Conn.Execute(&quot;SELECT *, STOCK_CODE AS Expr1 FROM [Copy-PartMaster Lite] WHERE (STOCK_CODE LIKE N'40016%')&quot;)<br>If Not RS.EOF Then<br> Do<br> Response.Write RS(&quot;STOCK_CODE&quot;) & &quot; &quot; & RS(&quot;DESCRIPTION&quot;)<br> Response.Write &quot;&quot;<br> RS.Movenext<br> Loop Until RS.EOF<br>Else<br> msgbox &quot;Empty Baby&quot;<br>End If<br>%&gt;<br>&lt;% do while not RS.eof %&gt;<br>&lt;%= RS(0) %&gt; <br>&lt;% RS.movenext <br>loop%&gt;<br><br>&lt;% RS.close %&gt;<br><br>&lt;/body&gt;<br><br>&lt;/html&gt;<br>---------------------------<br>where is has &quot;LIKE N'40016%&quot; I would like to replace this with a variable of some sort like a text box on a WEB page form.<br>When I create a submit button what do I put in it.<br>I am using Front Page 2000 for WEB creation<br><br>TIA <p>DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you be more productive.
 
Thanks Nick,<br> <p>DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you be more productive.
 
I use this so far, it's part of my Database Navigator (The file one is very similar, only it goes into directories , and so forth showing all the exe/ocx/dll versions)<br><br>Note how it calls itself, and processes a Form post<br><br><FONT FACE=monospace><br>&lt;%@ Language=VBScript %&gt;<br>&lt;HTML&gt;<br>&lt;HEAD&gt;<br>&nbsp;&lt;Title&gt;DataBase Navigator&lt;/Title&gt;<br>&nbsp;&lt;Script Language=&quot;JavaScript&quot;&gt;<br>&nbsp;&nbsp;&lt;!--<br>&nbsp;&nbsp;function Go(thePath)<br>&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;DSNFrm.Path.value = thePath;<br>&nbsp;&nbsp;&nbsp;DSNFrm.submit();<br>&nbsp;&nbsp;}<br>&nbsp;&nbsp;--&gt;<br>&nbsp;&lt;/Script&gt;<br>&lt;/HEAD&gt;<br>&lt;BODY&gt;<br>&lt;Form name=&quot;DSNFrm&quot; action=&quot;DSNNav.asp&quot; method=&quot;post&quot;&gt;<br>&nbsp;&lt;input type=&quot;hidden&quot; name=&quot;Path&quot;&gt;<br>&lt;/Form&gt;<br>&lt;%<br>set OU = Server.CreateObject(&quot;WsUtil.ODBCs&quot;)<br>Dim KeyLoop<br><br>If not IsEmpty(Request.Form(&quot;Path&quot;)) and Request.Form(&quot;Path&quot;) &lt;&gt; &quot;Root&quot; then<br>&nbsp;Dim AllValue<br>&nbsp;AllValue = OU.getallValName(Request.Form(&quot;Path&quot;))<br> <br>&nbsp;If VarType(AllValue) = vbArray + vbVariant then<br>&nbsp;&nbsp;%&gt;<br>&nbsp;&nbsp;&lt;INPUT type=&quot;button&quot; value=&quot;Back&quot; onclick=&quot;Go('Root')&quot;&gt;<br>&nbsp;&nbsp;&lt;Table border=1 width=&quot;75%&quot; align=center&gt;<br>&nbsp;&nbsp;&lt;TH align=center colspan=2 bgcolor=Black&gt;&lt;Font color=White&gt; &lt;%=Request.Form(&quot;Path&quot;)%&gt; &lt;/Font&gt;&lt;/TH&gt;<br>&nbsp;&nbsp;&lt;TR&gt;<br>&nbsp;&nbsp;&nbsp;&lt;TD bgcolor=Black align=center&gt;&lt;Font color=White&gt; Setting &lt;/Font&gt;&lt;/TD&gt;<br>&nbsp;&nbsp;&nbsp;&lt;TD bgcolor=Black align=center&gt;&lt;Font color=White&gt; Value&nbsp;&nbsp;&nbsp;&lt;/Font&gt;&lt;/TD&gt;<br>&nbsp;&nbsp;&lt;/TR&gt;<br>&nbsp;&nbsp;&lt;%<br>&nbsp;&nbsp;For KeyLoop = 0 to UBound(AllValue)<br>&nbsp;&nbsp;&nbsp;%&gt;<br>&nbsp;&nbsp;&nbsp;&lt;TR&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;TD&gt;&lt;%=AllValue(KeyLoop,0)%&gt; &lt;/TD&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;TD&gt;&lt;%=AllValue(KeyLoop,1)%&gt; &lt;/TD&gt;<br>&nbsp;&nbsp;&nbsp;&lt;/TR&gt;<br>&nbsp;&nbsp;&nbsp;&lt;%<br>&nbsp;&nbsp;next<br>&nbsp;&nbsp;%&gt;&lt;/Table&gt;&lt;% <br>&nbsp;end if<br>else<br>&nbsp;Dim AllDSN<br>&nbsp;AllDSN = OU.GetAllDSN<br> <br>&nbsp;If VarType(AllDSN) = vbArray + vbVariant then<br>&nbsp;&nbsp;%&gt;<br>&nbsp;&nbsp;&lt;Table border=1 width=&quot;75%&quot; align=center&gt;<br>&nbsp;&nbsp;&lt;TH align=center colspan=2 bgcolor=Black&gt;&lt;Font color=White&gt; Root &lt;/Font&gt;&lt;/TH&gt;<br>&nbsp;&nbsp;&lt;TR&gt;<br>&nbsp;&nbsp;&nbsp;&lt;TD align=center bgcolor=Black&gt;&lt;Font color=White&gt; System DSN Name &lt;/Font&gt;&lt;/TD&gt;<br>&nbsp;&nbsp;&nbsp;&lt;TD align=center bgcolor=Black&gt;&lt;Font color=White&gt; Driver&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/Font&gt;&lt;/TD&gt;<br>&nbsp;&nbsp;&lt;/TR&gt;<br>&nbsp;&nbsp;&lt;%<br>&nbsp;&nbsp;For KeyLoop = 0 to UBound(AllDSN)<br>&nbsp;&nbsp;&nbsp;%&gt;<br>&nbsp;&nbsp;&nbsp;&lt;TR&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;TD onclick=&quot;Go('&lt;%=AllDSN(KeyLoop,0)%&gt;')&quot;&gt;&lt;%=AllDSN(KeyLoop, 0)%&gt; &lt;/TD&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;TD&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt;&lt;%=AllDSN(KeyLoop, 1)%&gt; &lt;/TD&gt;<br>&nbsp;&nbsp;&nbsp;&lt;/TR&gt;<br>&nbsp;&nbsp;&nbsp;&lt;%<br>&nbsp;&nbsp;next<br>&nbsp;&nbsp;%&gt;&lt;/Table&gt;&lt;%<br>&nbsp;end if<br>end if<br>%&gt;<br>&lt;/BODY&gt;<br>&lt;/HTML&gt;<br></font><br><br> <p>Karl<br><a href=mailto:kb244@kb244.8m.com>kb244@kb244.8m.com</a><br><a href= </a><br>Experienced in , or have messed with : VC++, Borland C++ Builder, VJ++6(starting),VB-Dos, VB1 thru VB6, Delphi 3 pro, Borland C++ 3(DOS), Borland C++ 4.5, HTML,Visual InterDev 6, ASP(WebProgramming), QBasic(least i didnt start with COBOL)
 
&lt;html&gt;<br>&lt;body&gt;<br>&lt;FORM NAME=theform&quot; ACTION=&quot;thecodeabove.asp&quot; method=&quot;get&quot;&gt;<br>&nbsp;&lt;PRE&gt;<br>&nbsp;&nbsp;&lt;Input type =&quot;TEXT&quot; NAME=&quot;usersupplieddata&quot; SIZE = 10&gt;<br>&nbsp;&lt;/PRE&gt;<br>&nbsp;&nbsp;&lt;INPUT TYPE='submit&quot; VALUE=&quot;Send Query&quot;&gt;<br>&lt;/FORM&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;<br><br>in your code above add <br><br>'...<br>'...<br><br>dim uservar<br>uservar = request.querystring(&quot;usersupplieddata&quot;)<br>'...<br>' you can test usrvar to determine if your want to use<br>' 'LIKE vs. '=' in the query expression.<br><br>Conn.Execute(&quot;SELECT *, STOCK_CODE AS Expr1 FROM [Copy-PartMaster Lite] WHERE (STOCK_CODE LIKE '&quot; & uservar & &quot;%')&quot;)<br><br><br><br><br><br> <p>Amiel<br><a href=mailto:amielzz@netscape.net>amielzz@netscape.net</a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top