ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 2nd, 2011, 12:24 PM
methosk methosk is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2011
Posts: 3 methosk User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 44 m 2 sec
Reputation Power: 0
Variables with equal Value aren't Equal?

Ok, I am stumped. When I use Response.Write both of the variables are equal (1 = 1 or 2 = 2 etc) but when I use an if statement of if variable A = B, it doesn't register even when they are equal, however if i do an if statement of if A = 1 or if B = 1, it triggers. I am stumped, I think it may be because its a query result value (integer) equaling a form GET querystring variable, however, I have used this same exact setup in other situations and it has worked before, so I dunno. Here is the code, hopefully someone can point out what I did wrong :/

The code that isn't working is the
Code:
<% if Request.querystring("CCRID") = ccrRS("ID") then response.write(" selected") end if%>


Code:

<form name="DRILLDOWN2" action="CCR.asp" method="get" style="padding:5px;float:left;">
		<select name="CCRID" onchange="DRILLDOWN2.submit();" size="5" style="width:275px;">	
		<%
dim ccrObj
set ccrObj=Server.CreateObject("ADODB.Connection")
ccrObj.open(gsConnectionString)
const ccrSQL = "SELECT CCR.ID as ID, CCR.NAME as Name, CCRType.Type as Type FROM CCR INNER JOIN CCRType ON CCR.Type = CCRType.ID ORDER BY CCR.Name"
dim ccrRS
set ccrRS = Server.CreateObject("ADODB.Recordset")
ccrRS.Open ccrSQL, ccrObj
%>
<%
Do While not ccrRS.EOF 
%>
<option value="<% Response.Write ccrRS("ID") %>"<% if Request.querystring("CCRID") = ccrRS("ID") then response.write(" selected") end if%>><% Response.Write ccrRS("Name") %> - <% Response.Write ccrRS("Type") %></option>
<%
ccrRS.MoveNext
Loop 
ccrRS.Close
ccrObj.Close
%>	
		</select>
	</form>

Reply With Quote
  #2  
Old December 2nd, 2011, 03:03 PM
methosk methosk is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2011
Posts: 3 methosk User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 44 m 2 sec
Reputation Power: 0
Ok, I changed the code, and also made it to show what the values of the two variables are, still have the same problem, here is the new code-

Code:
<form name="DRILLDOWN2" action="CCR.asp" method="get" style="padding:5px;float:left;">
		<select name="CCRID" onchange="DRILLDOWN2.submit();" size="5" style="width:275px;">	
		<%
dim ccrObj
set ccrObj=Server.CreateObject("ADODB.Connection")
ccrObj.open(gsConnectionString)
const ccrSQL = "SELECT CCR.ID as ID, CCR.NAME as Name, CCRType.Type as Type FROM CCR INNER JOIN CCRType ON CCR.Type = CCRType.ID ORDER BY CCR.Type, CCR.Name"
dim ccrRS
set ccrRS = Server.CreateObject("ADODB.Recordset")
ccrRS.Open ccrSQL, ccrObj
dim ccrRSID
dim ccrQSID
ccrQSID = Request.QueryString("CCRID")
%>
<%
Do While not ccrRS.EOF 
ccrRSID = ccrRS("ID")
%>
<option value="<% Response.Write ccrRS("ID") %>"<% if ccrRSID = ccrQSID then response.write(" selected") end if%>><% Response.Write ccrRS("Name") %> - <% Response.Write ccrRS("Type") %> --- <%=ccrRSID%> = <%=ccrQSID%></option>
<%
ccrRS.MoveNext
Loop 
ccrRS.Close
ccrObj.Close
%>	
		</select>
	</form>


And Here is a screen shot, that shows that 3 = 3, and yet the code isn't including the " selected" at the end of the option -.-

URL
hmmm... The image tag isnt working properly :/
http://www.sabrelink.com/assets/Problem.jpg

Also, oddly enough, the second box in the picture, uses the same exact code structure (with different variables, but the same get variable = query variable stucture) and yet it works perfectly fine -.- I really dunno what is going wrong here.

Reply With Quote
  #3  
Old December 2nd, 2011, 04:59 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Jun 2003
Posts: 14,257 Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 4 Weeks 18 h 51 m 19 sec
Reputation Power: 4445
Add debug probes using response.write <variable I want to see> and verify your variable values are in fact what you expect.
__________________
======
Doug G
======
It is a truism of American politics that no man who can win an election deserves to. --Trevanian, from the novel Shibumi

Reply With Quote
  #4  
Old December 2nd, 2011, 05:44 PM
methosk methosk is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2011
Posts: 3 methosk User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 44 m 2 sec
Reputation Power: 0
Quote:
Originally Posted by Doug G
Add debug probes using response.write <variable I want to see> and verify your variable values are in fact what you expect.


Thats what I did in the second post

Code:
<option value="<% Response.Write ccrRS("ID") %>"<% if ccrRSID = ccrQSID then response.write(" selected") end if%>><% Response.Write ccrRS("Name") %> - <% Response.Write ccrRS("Type") %> --- <%=ccrRSID%> = <%=ccrQSID%></option>


Notice the end, shows ccrRSID and ccQSID. Both are functioning as they should, QSID is the QueryString Id (which stays the same) while ccrRSID is the ID of they incremental query return.

In the image that I posted a link to (the IMG code doesn't seem to want to cooperate with me on this forum) it shows the ccrRSID going from 1 to 3, while the ccQSID stays at 3, and yet, the option 3 is not selected (and in the view source, it does not show selected on any of them).

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > Variables with equal Value aren't Equal?

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap