Wrox Programmer Forums
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old December 11th, 2004, 01:36 PM
Friend of Wrox
Join Date: May 2004
Posts: 105
Thanks: 0
Thanked 0 Times in 0 Posts
Default Stupid Problem... on comparing variables!

I `ve got this f***** prob the last 30 minutes. And my head is total stuck!!!
So please... tell me... What`s wrong???

Dim oRSbn, pecode, code
pecode = Request.Querystring("code")
Set oRSbn=server.createobject("ADODB.recordset")

sqltext = " SELECT * from choices ;"
oRSbn.open sqltext, "DSN=anthem"


Do while NOT oRSbn.eof

code = oRSbn("code")

if (code=pecode) then
<tr><td width='100%'><%=oRSbn("choice")%></td></tr>
<tr><td width='100%'><a target="_top" href="main.asp?code=<%=code%>"><%= oRSbn("choice")%></a></td></tr>
    end if

Set oRSbn=nothing
info: the value from the Response.querystring is coming OK!

I guess the problem is on "if (code=pecode) then"
cause when I tried e.g. "if (code="4") then" it worked fine!!!

Old December 11th, 2004, 06:00 PM
Friend of Wrox
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41


Your problems will be solved quicker if you post the error (including line number if possible), you have you run the code I assume?

Anyhow, you say:
;;;I guess the problem is on "if (code=pecode) then"
cause when I tried e.g. "if (code="4") then" it worked fine!!!

What DB field data type is oRSbn("code")? A string I assume since "4" is and you say this works. Response.write code and pecode to determine what values they hold. If on face value they hold equal values, then check their data types. If they are equal in values and in data type then that line shouldn’t have a problem. What error are you getting?

Wind is your friend

Similar Threads
Thread Thread Starter Forum Replies Last Post
Comparing two variables by using = operator in xsl saurabh_inblore XSLT 1 February 2nd, 2007 05:22 AM
really stupid problem with anchor tags thenoseknows ASP.NET 2.0 Basics 3 August 31st, 2006 09:34 AM
Stupid Problem with Example alanmdunsmuir BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 1 May 31st, 2006 08:55 AM
Comparing floating point variables patpicos BOOK: Beginning Java 2, JDK 5 Edition 0 February 1st, 2005 12:37 AM
Stupid problem tsimsha Pro VB 6 2 December 16th, 2004 12:45 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.