Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: picking up values from db


Message #1 by "Adam H-W" <adam_hw@k...> on Fri, 29 Nov 2002 13:20:40
Hi 

Hoping someone can help me.

I'm trying to pick up numeric values in my db from the CategoryID column 
in my product categories table using check boxes.  However, when I view 
source it is not showing the id number, just showing the 
following....value="Sequence_CategoryID.  Here is the relevant code:

<%
         	Dim intSequence_
			intSequence_ = ("Sequence_"& ("CategoryID"))
			strSQL = "SELECT pc.CategoryID FROM 
ProductCategories pc WHERE TV = '1'"
          	set CategoryID = con.execute(strSQL)
		  	%>
			  <td>
              <div align="center">
                  <input type="checkbox" name="checkbox" value="<%
=intSequence_%>" class="TextBox">
              </div>
            </td>

Any help would be much appreciated.

thanks

Adam
Message #2 by "Carl E. Olsen" <carl-olsen@m...> on Fri, 29 Nov 2002 07:12:26 -0600
It looks like CategoryID is an object, instead of a string or numeric
value.

> -----Original Message-----
> From: Adam H-W [mailto:adam_hw@k...]
> Sent: Friday, November 29, 2002 1:21 PM
> To: ASP Databases
> Subject: [asp_databases] picking up values from db
> 
> Hi
> 
> Hoping someone can help me.
> 
> I'm trying to pick up numeric values in my db from the CategoryID
column
> in my product categories table using check boxes.  However, when I
view
> source it is not showing the id number, just showing the
> following....value="Sequence_CategoryID.  Here is the relevant code:
> 
> <%
>          	Dim intSequence_
> 			intSequence_ = ("Sequence_"& ("CategoryID"))
> 			strSQL = "SELECT pc.CategoryID FROM
> ProductCategories pc WHERE TV = '1'"
>           	set CategoryID = con.execute(strSQL)
> 		  	%>
> 			  <td>
>               <div align="center">
>                   <input type="checkbox" name="checkbox" value="<%
> =intSequence_%>" class="TextBox">
>               </div>
>             </td>
> 
> Any help would be much appreciated.
> 
> thanks
> 
> Adam
> to unsubscribe send a blank email to leave-asp_databases-
> 1112136X@p...


Message #3 by "Ian: Future Proof Web Dev" <lists@f...> on Fri, 29 Nov 2002 13:16:58 -0000
try this

intSequence_ = "Sequence_ " & CategoryID


----- Original Message -----
From: "Adam H-W" <adam_hw@k...>
To: "ASP Databases" <asp_databases@p...>
Sent: Friday, November 29, 2002 1:20 PM
Subject: [asp_databases] picking up values from db


> Hi
>
> Hoping someone can help me.
>
> I'm trying to pick up numeric values in my db from the CategoryID column
> in my product categories table using check boxes.  However, when I view
> source it is not showing the id number, just showing the
> following....value="Sequence_CategoryID.  Here is the relevant code:
>
> <%
>          Dim intSequence_
> intSequence_ = ("Sequence_"& ("CategoryID"))
> strSQL = "SELECT pc.CategoryID FROM
> ProductCategories pc WHERE TV = '1'"
>           set CategoryID = con.execute(strSQL)
>   %>
>   <td>
>               <div align="center">
>                   <input type="checkbox" name="checkbox" value="<%
> =intSequence_%>" class="TextBox">
>               </div>
>             </td>
>
> Any help would be much appreciated.
>
> thanks
>
> Adam
>

Message #4 by Colin.Montgomery@C... on Fri, 29 Nov 2002 13:31:34 -0000
Adam,

You're literally setting the variable like so:
intSequence_ = ("Sequence_"& ("CategoryID"))

so intSequence will hold:
Sequence_CategoryID

I.e. it holds a string that you have specified.

Also, CategoryID will not hold the value of the ID, it will hold a Recordset
object.  I assume what you need is the following:

##################################################################
<%
'declare all variables
Dim strSequence, strSQL, rsCategory, conMyCon

'declare you connection string, DSN or whatever here
conMyCon =...

'set your querystring  (note no quotes around 1 as assume CategoryID field
is Integer
strSQL = "SELECT pc.CategoryID FROM ProductCategories pc WHERE TV = 1"

'get recordset
Set rsCategory = conMyCon.Execute(strSQL)

'set strSequence to whatever the prefix needs to be & the CategoryID from
the recordset
strSequence = "Sequence_CategoryID" & rsCategory("CategoryID")

'close the recordset object to free up it's memory resources
rsCategory.Close
Set rsCategory = Nothing
%>

<td>
     <div align="center">
            <input type="checkbox" name="checkbox" value="<%=intSequence%>"
class="TextBox">
     </div>
</td>
###################################################################

Hope this helps,
Col

-----Original Message-----
From: Adam H-W [mailto:adam_hw@k...]
Sent: 29 November 2002 13:21
To: ASP Databases
Subject: [asp_databases] picking up values from db


Hi 

Hoping someone can help me.

I'm trying to pick up numeric values in my db from the CategoryID column 
in my product categories table using check boxes.  However, when I view 
source it is not showing the id number, just showing the 
following....value="Sequence_CategoryID.  Here is the relevant code:

<%
         	Dim intSequence_
			intSequence_ = ("Sequence_"& ("CategoryID"))
			strSQL = "SELECT pc.CategoryID FROM 
ProductCategories pc WHERE TV = '1'"
          	set CategoryID = con.execute(strSQL)
		  	%>
			  <td>
              <div align="center">
                  <input type="checkbox" name="checkbox" value="<%
=intSequence_%>" class="TextBox">
              </div>
            </td>

Any help would be much appreciated.

thanks

Adam


*******

This message and any attachment are confidential and may be privileged or otherwise protected from disclosure.  If you are not the
intended recipient, please telephone or email the sender and delete this message and any attachment from your system.  If you are
not the intended recipient you must not copy this message or attachment or disclose the contents to any other person.

For further information about Clifford Chance please see our website at http://www.cliffordchance.com or refer to any Clifford
Chance office.

Message #5 by "Adam H-W" <adam_hw@k...> on Fri, 29 Nov 2002 16:10:39 -0000
Great, thanks alot Colin

however I'm getting a type mismatch on the following line:

strSequence = "Sequence_CategoryID" & rsCategory("CategoryID")

Do you know why this might be?

thanks

Adam


Tel: 0208 877 0077
Fax: 0208 874 7851
adam_hw@k...
----- Original Message -----
From: <Colin.Montgomery@C...>
To: "ASP Databases" <asp_databases@p...>
Sent: Friday, November 29, 2002 1:31 PM
Subject: [asp_databases] RE: picking up values from db


> Adam,
>
> You're literally setting the variable like so:
> intSequence_ = ("Sequence_"& ("CategoryID"))
>
> so intSequence will hold:
> Sequence_CategoryID
>
> I.e. it holds a string that you have specified.
>
> Also, CategoryID will not hold the value of the ID, it will hold a
Recordset
> object.  I assume what you need is the following:
>
> ##################################################################
> <%
> 'declare all variables
> Dim strSequence, strSQL, rsCategory, conMyCon
>
> 'declare you connection string, DSN or whatever here
> conMyCon =...
>
> 'set your querystring  (note no quotes around 1 as assume CategoryID field
> is Integer
> strSQL = "SELECT pc.CategoryID FROM ProductCategories pc WHERE TV = 1"
>
> 'get recordset
> Set rsCategory = conMyCon.Execute(strSQL)
>
> 'set strSequence to whatever the prefix needs to be & the CategoryID from
> the recordset
> strSequence = "Sequence_CategoryID" & rsCategory("CategoryID")
>
> 'close the recordset object to free up it's memory resources
> rsCategory.Close
> Set rsCategory = Nothing
> %>
>
> <td>
>      <div align="center">
>             <input type="checkbox" name="checkbox"
value="<%=intSequence%>"
> class="TextBox">
>      </div>
> </td>
> ###################################################################
>
> Hope this helps,
> Col
>
> -----Original Message-----
> From: Adam H-W [mailto:adam_hw@k...]
> Sent: 29 November 2002 13:21
> To: ASP Databases
> Subject: [asp_databases] picking up values from db
>
>
> Hi
>
> Hoping someone can help me.
>
> I'm trying to pick up numeric values in my db from the CategoryID column
> in my product categories table using check boxes.  However, when I view
> source it is not showing the id number, just showing the
> following....value="Sequence_CategoryID.  Here is the relevant code:
>
> <%
>          Dim intSequence_
> intSequence_ = ("Sequence_"& ("CategoryID"))
> strSQL = "SELECT pc.CategoryID FROM
> ProductCategories pc WHERE TV = '1'"
>           set CategoryID = con.execute(strSQL)
>   %>
>   <td>
>               <div align="center">
>                   <input type="checkbox" name="checkbox" value="<%
> =intSequence_%>" class="TextBox">
>               </div>
>             </td>
>
> Any help would be much appreciated.
>
> thanks
>
> Adam
>
>
> *******
>
> This message and any attachment are confidential and may be privileged or
otherwise protected from disclosure.  If you are not the intended recipient,
please telephone or email the sender and delete this message and any
attachment from your system.  If you are not the intended recipient you must
not copy this message or attachment or disclose the contents to any other
person.
>
> For further information about Clifford Chance please see our website at
http://www.cliffordchance.com or refer to any Clifford Chance office.
>
>
>




  Return to Index