Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Cstr Woes

 
Logged in as: Guest
arrSession:exec spGetSession 2,3,29846
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> ASP >> Cstr Woes
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Cstr Woes - 1/13/2006 12:22:32 AM   
  Latro_

 

Posts: 1
Score: 0
Joined: 1/13/2006
Status: offline
Right here is some code:

dim cf
dim cfs
 dim x
 x=0
 rsGetItems.MoveFirst
           
  while (x <> 1)
   
   cf = rsGetItems.Fields.Item("ExVisField").Value
   cfs = CStr(cf)
   
   response.write "CF= " & cfs
   
    if  cfs = 'title' then
     
     response.write "TITITITITITITITITITITS"
    
     fieldstr = fieldstr & "&itemID" & rsGetItems.Fields.Item("item_id").Value & "="
    
    end if
     
   response.write "<BR>" & (rsGetItems.Fields.Item("ExVisField").Value)
   rsGetItems.MoveNext
                      
     If rsGetItems.EOF Then
               'rsSurvey.MoveLast
                x=1
            End If
  wend


Output:

CF= clientpk
clientpk CF= title
title CF= initials
initials CF= surname
surname CF= custom2
custom2 CF= custom1
custom1 CF= custom5
custom5 CF= postcode
postcode CF=
CF=
CF=
CF=
CF=
CF=
CF=
CF=
CF=
CF=
CF=
CF=
CF=


In the example above I have a varible assigned the value from a record set field request.  This is then converted into a string (via CStr) (seemingly)
If this string is equal to "title" the red code is executed.  As can be seen from the output this IF statement is never intialised so the varible cannot be seen as a string even though i have converted it.

any help would be great as this is driving me insane.
 
 
Post #: 1
 
 RE: Cstr Woes - 1/13/2006 12:26:32 AM   
  Country73


Posts: 733
Score: 10
Joined: 8/25/2004
From: USA
Status: offline
Just taking a quick stab at it here.
For the code you have in red:
    if cfs = 'title' then

Are you checking to see if the string is actually "title"?
If so, you'll need to put title in double quotes "title".

Like I said, I'm just taking a quick stab at this and it's the first thing I noticed.

(in reply to Latro_)
 
 
Post #: 2
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> ASP >> Cstr Woes Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts