Re: How to refer to a class property while in that class. (Solved)
- From: "Dan" <danncasey@xxxxxxxxx>
- Date: 2 May 2006 10:29:32 -0700
still not working as expected (trying several methods). Here is
exactly what im doing.
Main code:------------- (assume there is a post variable:
existing="no")
Set dp = new classDataProcessor
If len(session("token")) < 20 Then
' this must be a new visit. Lets get a token
dp.MakeToken
End IF
' new or existing?
If Request.Form("existing") = "no" Then
' we want to make a NEW form.
dp.MakeNew
Else
' not relevent to this post
End If
Response.Write("my token is: " & dp.token)
Class Code:----------------
Class classDataProcessor
Private m_token
Public Property Get Token()
Token = m_token
End Property
Public Property Let Token(p_data)
' private - this should be set only by makeToken()
m_token = p_data
session("token") = p_data
End Property
Public Function makeToken()
' Generates a token. Stores it in the Token Property of this class
Dim i
Dim tmpToken
Dim randnum
Dim Values
Vals =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-()!#,[]"
Randomize
'While need to make sure its not taken in the tmp table
For i = 1 to 20
randnum = int(rnd*len(Vals)) +1
tmpToken = tmpToken & mid(Vals,randnum,1)
Next
'Wend
'Me.Token = tmpToken
'm_token = tmpToken
token = tmpToken
session("token") = tmpToken
makeToken = true
End Function
Public Function makeNew()
If Len(Token) <> 20 Then
'If Len(m_token) <> 20 Then
'If Len(me.Token) <> 20 Then
Response.Write("in makeNew: " & Token & ".")
MakeToken
End If
Dim sql
SQL = "INSERT INTO imf (TMP_Token,TMP_LastTouch,form_name) " &
_
" VALUES('" & Me.Token & "'," & _
" now()," & _
" 'test')"
'DBHandle.ExecuteUpdateSQL(SQL)
Response.Write(SQL)
makeNew = True
End Function
--------------------------------------------------------
I don't see what im doing wrong. Token is always empty when the makenew
function is called. Do you see that i am doing something wrong?
.
- Follow-Ups:
- References:
- How to refer to a class property while in that class.
- From: Dan
- Re: How to refer to a class property while in that class. (Solved)
- From: Dan
- Re: How to refer to a class property while in that class. (Solved)
- From: Dan
- Re: How to refer to a class property while in that class. (Solved)
- From: mayayana
- Re: How to refer to a class property while in that class. (Solved)
- From: Dan
- Re: How to refer to a class property while in that class. (Solved)
- From: Dan
- Re: How to refer to a class property while in that class. (Solved)
- From: mayayana
- How to refer to a class property while in that class.
- Prev by Date: status; .vbs return status to .cmd
- Next by Date: Re: Enumerate Glodal group ADSI
- Previous by thread: Re: How to refer to a class property while in that class. (Solved)
- Next by thread: Re: How to refer to a class property while in that class. (Solved)
- Index(es):
Relevant Pages
|