Ask a Question related to ASP Database, Design and Development.
-
Ryan Malone #1
Passing Dictionary object byref
Passing Dictionary object byref
Ive created an ASP class that uses a dictionary object which is filled
from a recordset. It passes the object to the propterty of another ASP
class byref:
Public Property Let dicReplaceVars(byref vdicReplaceVars)
set p_ReplaceVars = vdicReplaceVars
End Property
Private p_ReplaceVars
where it is used in this other class a few times to replace values in
an array:
Function ReplaceVars(vArrayItem)
' turn it into an array split at spaces
vArrayItem = split(vArrayItem," ")
' loop through the array
for count = lbound(vArrayItem) to ubound(vArrayItem)
'See if it is a replacement variable and exists in the dictionary
if left(vArrayItem(count),6) = "tkRep_" and
p_ReplaceVars.exists(vArrayItem(count)) then
' then replace it
Error occurs here >> vArrayItem(count) =
p_ReplaceVars.Item(cstr(vArrayItem(count)))
end if
next
dim vArrayItemNew
vArrayItemNew = ""
' Loop through the array and put it back together
for count = lbound(vArrayItem) to ubound(vArrayItem)
if vArrayItem(count) = ubound(vArrayItem) then
vArrayItemNew = vArrayItemNew & vArrayItem(count)
else
vArrayItemNew = vArrayItemNew & vArrayItem(count) & " "
end if
next
' return the vArrayItemNew to the function
ReplaceVars = vArrayItemNew
End Function
The error message I get is:
ADODB.Field (0x800A0D5C)
Object is no longer valid.
D:\WWW\LCDEV\DOC_FUNCTIONS\../classes/classlcDocTKit_item.asp, line 52
However I have no idea why, it is a dictionary object and not a
recordset, the object should still be open.
Any help is greatly appreciated.
Thanks
Ryan Malone Guest
-
ASP: Can Dictionary object store arrays or recordsets as items?
Title says it all. Anyone know if the ASP/ VBScript dictionary object can store other collections -- say, arrays, recordsets, or other Dictionaries... -
Dictionary Object
Wondering if someone can give me a hand with something that I'm sure is really easy - but damned if I know what I'm doing wrong. I'm trying to read... -
Passing an object
Hey again! I have a quick question about passing objects to other classes. What I am trying to do is create an object, and then pass that object... -
Can you return a dictionary object from a function?
"Mark Schupp" <mschupp@ielearning.com> wrote in message news:OwPxqtxPDHA.1748@TK2MSFTNGP11.phx.gbl... doh! -
Dictionary Object Replacement
Hi, Is there an equivalent object that I can use to replace the regular Dictionary object? I played with DictionaryBase and DictionaryEntry and... -
Ryan Malone #2
Passing Dictionary object byref
Passing Dictionary object byref
Ive created an ASP class that uses a dictionary object which is filled
from a recordset. It passes the object to the propterty of another ASP
class byref:
Public Property Let dicReplaceVars(byref vdicReplaceVars)
set p_ReplaceVars = vdicReplaceVars
End Property
Private p_ReplaceVars
where it is used in this other class a few times to replace values in
an array:
Function ReplaceVars(vArrayItem)
' turn it into an array split at spaces
vArrayItem = split(vArrayItem," ")
' loop through the array
for count = lbound(vArrayItem) to ubound(vArrayItem)
'See if it is a replacement variable and exists in the dictionary
if left(vArrayItem(count),6) = "tkRep_" and
p_ReplaceVars.exists(vArrayItem(count)) then
' then replace it
Error occurs here >> vArrayItem(count) =
p_ReplaceVars.Item(cstr(vArrayItem(count)))
end if
next
dim vArrayItemNew
vArrayItemNew = ""
' Loop through the array and put it back together
for count = lbound(vArrayItem) to ubound(vArrayItem)
if vArrayItem(count) = ubound(vArrayItem) then
vArrayItemNew = vArrayItemNew & vArrayItem(count)
else
vArrayItemNew = vArrayItemNew & vArrayItem(count) & " "
end if
next
' return the vArrayItemNew to the function
ReplaceVars = vArrayItemNew
End Function
The error message I get is:
ADODB.Field (0x800A0D5C)
Object is no longer valid.
D:\WWW\LCDEV\DOC_FUNCTIONS\../classes/classlcDocTKit_item.asp, line 52
However I have no idea why, it is a dictionary object and not a
recordset, the object should still be open.
Any help is greatly appreciated.
Thanks
Ryan Malone Guest
-
Ray at #3
Re: Passing Dictionary object byref
Are you looking at the right line in the right page? Like, is
classlcDocTKit_item.asp an include file perhaps, and you're looking at line
52 in the page with the include directive instead?
Ray at work
"Ryan Malone" <ryanswebsite@hotmail.com> wrote in message
news:e8386b53.0309150055.f36d9e6@posting.google.co m...
>
> ADODB.Field (0x800A0D5C)
> Object is no longer valid.
> D:\WWW\LCDEV\DOC_FUNCTIONS\../classes/classlcDocTKit_item.asp, line 52
>
> However I have no idea why, it is a dictionary object and not a
> recordset, the object should still be open.
>
> Any help is greatly appreciated.
>
> Thanks
Ray at Guest
-
Ray at #4
Re: Passing Dictionary object byref
[url]http://www.aspfaq.com/5003[/url]
Ray at work
"Ryan Malone" <ryanswebsite@hotmail.com> wrote in message
news:e8386b53.0309150056.4c30338@posting.google.co m...> Passing Dictionary object byref
>
Ray at Guest
-
Ryan Malone #5
Re: Passing Dictionary object byref
Hi Ray
Thanks for the reply, the code that ive included is from
classlcDocTKit_item.asp. It has got me completely stumped.
"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message news:<eP9MFg4eDHA.2332@TK2MSFTNGP12.phx.gbl>...> Are you looking at the right line in the right page? Like, is
> classlcDocTKit_item.asp an include file perhaps, and you're looking at line
> 52 in the page with the include directive instead?
>
> Ray at work
>
> "Ryan Malone" <ryanswebsite@hotmail.com> wrote in message
> news:e8386b53.0309150055.f36d9e6@posting.google.co m...
>> >
> > ADODB.Field (0x800A0D5C)
> > Object is no longer valid.
> > D:\WWW\LCDEV\DOC_FUNCTIONS\../classes/classlcDocTKit_item.asp, line 52
> >
> > However I have no idea why, it is a dictionary object and not a
> > recordset, the object should still be open.
> >
> > Any help is greatly appreciated.
> >
> > ThanksRyan Malone Guest
-
Passing Dictionary object byref
Ive created an ASP class that uses a dictionary object which is filled from a recordset. It passes the object to the propterty of another ASP class byref:
Public Property Let dicReplaceVars(byref vdicReplaceVars)
set p_ReplaceVars = vdicReplaceVars
End Property
Private p_ReplaceVars
where it is used in this other class a few times to replace values in an array:
Function ReplaceVars(vArrayItem)
'' turn it into an array split at spaces
vArrayItem = split(vArrayItem," ")
'' loop through the array
for count = lbound(vArrayItem) to ubound(vArrayItem)
''See if it is a replacement variable and exists in the dictionary
if left(vArrayItem(count),6) = "tkRep_" and
p_ReplaceVars.exists(vArrayItem(count)) then
'' then replace it
Error occurs here >> vArrayItem(count) =
p_ReplaceVars.Item(cstr(vArrayItem(count)))
end if
next
dim vArrayItemNew
vArrayItemNew = ""
'' Loop through the array and put it back together
for count = lbound(vArrayItem) to ubound(vArrayItem)
if vArrayItem(count) = ubound(vArrayItem) then
vArrayItemNew = vArrayItemNew & vArrayItem(count)
else
vArrayItemNew = vArrayItemNew & vArrayItem(count) & " "
end if
next
'' return the vArrayItemNew to the function
ReplaceVars = vArrayItemNew
End Function
The error message I get is:
ADODB.Field (0x800A0D5C)
Object is no longer valid. D:\WWW\LCDEV\DOC_FUNCTIONS\../classes/classlcDocTKit_item.asp, line 52
However I have no idea why, it is a dictionary object and not a recordset, the object should still be open.
Any help is greatly appreciated.
Thanks
-----------------------------
This message is posted by [url]http://Asp.ForumsZone.com[/url]
Guest
-
Mark Schupp #7
Re: Passing Dictionary object byref
When you set the data into the dictionary object from the recordset make
sure you use the value. ie:
rsdata("mycol").value
not
rsdata("mycol")
which returns a field object, not the field's value.
--
Mark Schupp
--
Head of Development
Integrity eLearning
Online Learning Solutions Provider
[email]mschupp@ielearning.com[/email]
[url]http://www.ielearning.com[/url]
714.637.9480 x17
<ryan@lawcentral.com.au> wrote in message
news:307276501046384@Asp.ForumsZone.com...from a recordset. It passes the object to the propterty of another ASP class> Ive created an ASP class that uses a dictionary object which is filled
byref:array:>
> Public Property Let dicReplaceVars(byref vdicReplaceVars)
> set p_ReplaceVars = vdicReplaceVars
> End Property
>
>
> Private p_ReplaceVars
>
>
> where it is used in this other class a few times to replace values in anD:\WWW\LCDEV\DOC_FUNCTIONS\../classes/classlcDocTKit_item.asp, line 52>
> Function ReplaceVars(vArrayItem)
>
> '' turn it into an array split at spaces
> vArrayItem = split(vArrayItem," ")
> '' loop through the array
> for count = lbound(vArrayItem) to ubound(vArrayItem)
>
> ''See if it is a replacement variable and exists in the dictionary
> if left(vArrayItem(count),6) = "tkRep_" and
> p_ReplaceVars.exists(vArrayItem(count)) then
> '' then replace it
> Error occurs here >> vArrayItem(count) =
> p_ReplaceVars.Item(cstr(vArrayItem(count)))
> end if
> next
>
> dim vArrayItemNew
> vArrayItemNew = ""
>
> '' Loop through the array and put it back together
> for count = lbound(vArrayItem) to ubound(vArrayItem)
>
> if vArrayItem(count) = ubound(vArrayItem) then
> vArrayItemNew = vArrayItemNew & vArrayItem(count)
> else
> vArrayItemNew = vArrayItemNew & vArrayItem(count) & " "
> end if
> next
>
> '' return the vArrayItemNew to the function
> ReplaceVars = vArrayItemNew
> End Function
>
> The error message I get is:
>
> ADODB.Field (0x800A0D5C)
> Object is no longer valid.the object should still be open.>
> However I have no idea why, it is a dictionary object and not a recordset,>
> Any help is greatly appreciated.
>
> Thanks
>
> -----------------------------
> This message is posted by [url]http://Asp.ForumsZone.com[/url]
>
Mark Schupp Guest
-
Ryan Malone #8
Re: Passing Dictionary object byref
Thank you Mark you are a legend.
Solved my problem immediately, it was causing all sorts of weird things
to happen
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
Ryan Malone Guest



Reply With Quote

