Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: ASP Database posting to a response page


Message #1 by "Jim Lucore" <jim@l...> on Mon, 19 Feb 2001 13:36:16
Greetings,



I am trying to post to a response page using ASP Database functions. I have 

populated a drop down list and I am able to select the item I want. 

However when I hit the submit I receive an error stating that the data 

cannot be found. Here is the code that I am using for the form page and 

the response page:



You can visit www.inflightzone.com/listbox.asp to see what I am talking 

about.



If anyone can make a suggestion that works I will mention you name on my 

site, you may get some work if you want it.



Thanks

Jim Lucore

Webmaster

www.inflightzone.com



<----------Form page-------------->

<%

Dim oRScl

Set oRScl=Server.CreateObject("ADODB.Recordset")

oRScl.Open "images", "DSN=?????????" Deleted for security!

oRScl.MoveFirst

%>



<form METHOD="post" ACTION="displaybox.asp">

  <p><select NAME="aircraft" SIZE="1">

<%

Do while NOT oRScl.EOF

	Response.Write "<OPTION VALUE='" & oRScl("imgtype-txt") & "'>"

	Response.Write oRScl("imgtype-txt") & "</OPTION>"

	oRScl.MoveNext

Loop

oRScl.Close

Set oRScl=nothing

%>  </select></p>

  <p><input TYPE="submit"></p>

</form>







<----------Response page---------->



<%

vAircraft = Request.Form("aircraft")

Dim oRScl

Set oRScl=Server.CreateObject("ADODB.Recordset")

oRScl.Open "images", "DSN=Deeleted for security" DSN connection does work!

sqltxt = "SELECT * FROM images WHERE imgtype-txt = " & vAircraft & ";"

oRScl.MoveFirst

oRScl.Close

Set oRScl=nothing

%>

<%imgtype-txt%>



<p><img src="/_private/images/<%=image%>"> </p>



Message #2 by "Wally Burfine" <oopconsultant@h...> on Mon, 19 Feb 2001 16:54:45 -0000
You need to put single quotes around the string for the SQL statement to 

work:



sqltxt = "SELECT * FROM images WHERE imgtype-txt = '" & vAircraft & "';"



Regards,

Wally



>From: "Jim Lucore" <jim@l...>

>Reply-To: "ASP Databases" <asp_databases@p...>

>To: "ASP Databases" <asp_databases@p...>

>Subject: [asp_databases] ASP Database posting to a response page

>Date: Mon, 19 Feb 2001 13:36:16

>

>Greetings,

>

>I am trying to post to a response page using ASP Database functions. I have

>populated a drop down list and I am able to select the item I want.

>However when I hit the submit I receive an error stating that the data

>cannot be found. Here is the code that I am using for the form page and

>the response page:

>

>You can visit www.inflightzone.com/listbox.asp to see what I am talking

>about.

>

>If anyone can make a suggestion that works I will mention you name on my

>site, you may get some work if you want it.

>

>Thanks

>Jim Lucore

>Webmaster

>www.inflightzone.com

>

><----------Form page-------------->

><%

>Dim oRScl

>Set oRScl=Server.CreateObject("ADODB.Recordset")

>oRScl.Open "images", "DSN=?????????" Deleted for security!

>oRScl.MoveFirst

>%>

>

><form METHOD="post" ACTION="displaybox.asp">

>   <p><select NAME="aircraft" SIZE="1">

><%

>Do while NOT oRScl.EOF

>	Response.Write "<OPTION VALUE='" & oRScl("imgtype-txt") & "'>"

>	Response.Write oRScl("imgtype-txt") & "</OPTION>"

>	oRScl.MoveNext

>Loop

>oRScl.Close

>Set oRScl=nothing

>%>  </select></p>

>   <p><input TYPE="submit"></p>

></form>

>

>

>

><----------Response page---------->

>

><%

>vAircraft = Request.Form("aircraft")

>Dim oRScl

>Set oRScl=Server.CreateObject("ADODB.Recordset")

>oRScl.Open "images", "DSN=Deeleted for security" DSN connection does work!

>sqltxt = "SELECT * FROM images WHERE imgtype-txt = " & vAircraft & ";"

>oRScl.MoveFirst

>oRScl.Close

>Set oRScl=nothing

>%>

><%imgtype-txt%>

>

><p><img src="/_private/images/<%=image%>"> </p>

>

>

>

  Return to Index