Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: recordset and checkbox problem


Message #1 by lodris@m... on Tue, 22 May 2001 12:59:55
 I am pulling a table row from my database based on a user selection and i 

was wondering whether there was any way to place a checkbox beside the 

database row so that the user could verify that this was the information 

they were looking for.This is the code im using for it thanks.I have tried 

a few differnet ways but every way i do it i either get a checkbox for 

field or checkbox in the table border i set.

Leigh



set rst = conn.execute ("Select * FROM trade WHERE StockName = '" & stock 

& "' AND (getday = '"& Date & "')")

    <table width="98%" TABLE border = 1 bordercolorlight="#FF0033" 

bordercolordark="#FF0000" bordercolor="#FF0033">

           <tr bgcolor="#0000FF"> 

<%   

               Do while (Not rst.eof) %>



                     <tr>

                          <% For Index=0 to (rst.fields.count-1) %>

                            <TD VAlign=top><% = rst(Index)%></TD><% Next %>

                          

                     </tr>

             

                     <% rst.MoveNext 

               Loop 

           %>





           </TABLE>





           <%    

               rst.close

               conn.close 

           %>  



Message #2 by "Drew, Ron" <RDrew@B...> on Tue, 22 May 2001 09:05:09 -0400



Here's a little script you can use to cut and paste.  When the visitor picks

the stock, it passes control the the next asp.  Dont know if this will help

but here it is.

............................

 <%

response.buffer=true

Response.ExpiresAbsolute = Now() - 1

Response.AddHeader "Cache-Control", "private"

%>

<%

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'Gets the Parameters from Form

Dim strwheretolook, strstock

   strwheretolook = Request.Form("wheretolook")

   strstock = Request.Form("stock")

   Response.Write "<b>Parameters:  </b>"

   Response.Write "<b>wheretolook>  </b>"

   Response.Write strwheretolook

   Response.Write "<b>stock>  </b>"

   Response.Write strstock

   Response.Write "<br>"

   dim hdg  

	 Select Case strwheretolook

	   Case 1

	     hdg = "NYSE"

	   Case 2

	     hdg = "AMERICAN" 

	   Case 3

	     hdg = "TOYKO"  

	   Case 4

	     hdg = "FRANKFURT" 

	 end Select

%>

<html><head>

<title>Display Records</title>

<meta http-equiv="pragma" content="no-cache">

</head>

<body bgcolor="#00ffff" text="#000000" link="#0000ff" vlink="#ff00ff">

<font color="black" size="5"><strong>

<center>Stock Display</center>

</strong></font>

<%

mySQL = "select * from stocks "

mySQL = mySQL & "where inid = " & strwheretolook 

	 if not strstock = "" then

	   mySQL = mySQL & " AND stock = " & "'" & strstock & "'"

	 end if

mySQL = mySQL & " order by stock"

'Response.Write mySQL

idfield="stock"

scriptresponder="displaystock2.asp"

set conntemp=server.createobject("adodb.connection")

conntemp.open "DRIVER=SQL Server;SERVER=MYSERVER;UID=sa;APP=Microsoft Open

Database Connectivity;WSID=SNRM_48001F5M;DATABASE=sales;User

Id=sa;PASSWORD=;"

set rstemp=conntemp.execute(mySQL)

howmanyfields=rstemp.fields.count -1

%>

<table align="center" border="1">

<tr>

<td valign="top">   </td>

<% 'Put Headings On The Table of Field Names

for i=0 to howmanyfields %>

       <td align=center><b><%=rstemp(i).name %></b></td>

<% next %>

</tr>

<% ' Now lets grab all the records

do  while not rstemp.eof %>

   <tr><td valign="top">

   <%my_link=scriptresponder & "?which='" & rstemp(idfield) & "'"%>

   <a HREF="<%=my_link%>">Display</a></td>

   <% for i = 0 to howmanyfields%>

          <td valign="top"><%=rstemp(i)%></td>

   <% next %>

   </tr>

   <%

  rstemp.movenext

loop



rstemp.close

set rstemp=nothing

conntemp.close

set conntemp=nothing

%>

</table>

</body>

</html>



-----Original Message-----

From: lodris@m... [mailto:lodris@m...]

Sent: Tuesday, May 22, 2001 9:00 AM

To: ASP Databases

Subject: [asp_databases] recordset and checkbox problem





 I am pulling a table row from my database based on a user selection and i 

was wondering whether there was any way to place a checkbox beside the 

database row so that the user could verify that this was the information 

they were looking for.This is the code im using for it thanks.I have tried 

a few differnet ways but every way i do it i either get a checkbox for 

field or checkbox in the table border i set.

Leigh



set rst = conn.execute ("Select * FROM trade WHERE StockName = '" & stock 

& "' AND (getday = '"& Date & "')")

    <table width="98%" TABLE border = 1 bordercolorlight="#FF0033" 

bordercolordark="#FF0000" bordercolor="#FF0033">

           <tr bgcolor="#0000FF"> 

<%   

               Do while (Not rst.eof) %>



                     <tr>

                          <% For Index=0 to (rst.fields.count-1) %>

                            <TD VAlign=top><% = rst(Index)%></TD><% Next %>

                          

                     </tr>

             

                     <% rst.MoveNext 

               Loop 

           %>





           </TABLE>





           <%    

               rst.close

               conn.close 

           %>  





Message #3 by "Charles Feduke" <webmaster@r...> on Tue, 22 May 2001 10:15:20 -0400
	Try...



<% For Index = 0 To rst.Fields.Count - 1 %>

	<TD VALIGN="top">

		<INPUT TYPE="checkbox" NAME="check_<%=rst.Fields(Index).Name%>">

		<%=rst(Index)%>

	</TD>

<% Next %>



	When you get your return, just cycle the Request.Form (if you use HTTP

POST) for the values:



For Each item In Request.Form()

	If Left(item, 6) = "check_"

		' its one of the checkboxes

		' value == 1 if it was checked

	End If

Next



	Hope that helps.



? Chuck



> -----Original Message-----

> From: lodris@m... [mailto:lodris@m...]

> Sent: Tuesday, May 22, 2001 1:00 PM

> To: ASP Databases

> Subject: [asp_databases] recordset and checkbox problem

>

>

>  I am pulling a table row from my database based on a user

> selection and i

> was wondering whether there was any way to place a checkbox beside the

> database row so that the user could verify that this was the information

> they were looking for.This is the code im using for it thanks.I

> have tried

> a few differnet ways but every way i do it i either get a checkbox for

> field or checkbox in the table border i set.

> Leigh

>

> set rst = conn.execute ("Select * FROM trade WHERE StockName = '" & stock

> & "' AND (getday = '"& Date & "')")

>     <table width="98%" TABLE border = 1 bordercolorlight="#FF0033"

> bordercolordark="#FF0000" bordercolor="#FF0033">

>            <tr bgcolor="#0000FF">

> <%

>                Do while (Not rst.eof) %>

>

>                      <tr>

>                           <% For Index=0 to (rst.fields.count-1) %>

>                             <TD VAlign=top><% 

> rst(Index)%></TD><% Next %>

>

>                      </tr>

>

>                      <% rst.MoveNext

>                Loop

>            %>

>

>

>            </TABLE>

>

>

>            <%

>                rst.close

>                conn.close

>            %>

>

>

> ---

> *


  Return to Index