473,503 Members | 1,775 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

return dictionary from a function

JT
im trying to create a function that accepts a sql statement as a parameter,
makes a db connection, returns a recordset, and inserts all items from the
recordset into a data dictionary - then i want to set the value of my
function equal to my newly created dictionary of items from the recordset -
this is where im having a problem. is it possible to set a function equal
to a dictionary? i cant seem to make this work and it seems that this
should be possible.

here is some sample code:

Function ExecSQL(strSQL)

Set objDBInterface = Server.CreateObject("SPP.DBInterface")
Set rs = Server.CreateObject("ADODB.Recordset")
Set objDictionary = Server.CreateObject("Scripting.Dictionary")

sql = strSQL

objDBInterface.sql = sql
Set rs = objDBInterface.SelectSQL

' add rs to dictionary
for each field in rs.Fields
objDictionary.Item(Field.Name) = Field.Value
next

***asp is complaining here!!!#$@
ExecSQL = objDictionary

End if

End Function
'this is how im calling the function
rsDict = ExecSQL(sql)
tia
jt
Jul 19 '05 #1
1 6412
Set ExecSQL = objDictionary
--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"JT" <je******@sppinc.net> wrote in message
news:uR**************@tk2msftngp13.phx.gbl...
im trying to create a function that accepts a sql statement as a parameter, makes a db connection, returns a recordset, and inserts all items from the
recordset into a data dictionary - then i want to set the value of my
function equal to my newly created dictionary of items from the recordset - this is where im having a problem. is it possible to set a function equal
to a dictionary? i cant seem to make this work and it seems that this
should be possible.

here is some sample code:

Function ExecSQL(strSQL)

Set objDBInterface = Server.CreateObject("SPP.DBInterface")
Set rs = Server.CreateObject("ADODB.Recordset")
Set objDictionary = Server.CreateObject("Scripting.Dictionary")

sql = strSQL

objDBInterface.sql = sql
Set rs = objDBInterface.SelectSQL

' add rs to dictionary
for each field in rs.Fields
objDictionary.Item(Field.Name) = Field.Value
next

***asp is complaining here!!!#$@
ExecSQL = objDictionary

End if

End Function
'this is how im calling the function
rsDict = ExecSQL(sql)
tia
jt

Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
7034
by: Kathy Burke | last post by:
I'm trying to use the following code to use a javascript return confirm. Cancel would exit the sub and return the page to its history (-2). OK would proceed with the asp.net code, i.e., run the...
4
2396
by: Bryan Dickerson | last post by:
Ok, I've spent all this time creating a program to read an XML Document via XPaths and my boss is pretty thrilled, but now I have to return an XML document, so can someone point me to some sample...
2
1773
by: Jim Langston | last post by:
I'm a little confused. I have a class function declared like: const CItem& operator << (const std::string &sIn); Which I use like this: CItem Item; Item <<...
5
1900
by: PsiX | last post by:
Hi, does the return type specifier const for functions for built-in types ever make sense? Like in: const void DoSth(); const int DoSth();
3
19133
by: Melih Onvural | last post by:
Has anyone seen this error before and been able to solve it? I can't seem to find anything that leads to a solution. I found this post http://zope.org/Collectors/Zope/1809, but can't really...
6
1832
by: kdt | last post by:
Can anyone suggest a better way of returning the values in a dictionary as a single list. I have the following, but it uses a nested loop, not sure if there is a more efficient way. >>> d= >>>...
4
1923
by: tyv | last post by:
Hi, I encountered a bug on a website that I am working on. The enter/ return key function works in certain parts of the website and doesn't work in other parts. I went through all the scripts...
1
3923
by: news.microsoft.com | last post by:
I am getting the following error on the return from a function call.It specically happens on the assignment of the return value from the function call. No error happens inside the function. The...
2
1631
by: Andrew Hulting | last post by:
I know you can use erl, to return the line number of the error if you have it set, I would like to return the function or sub where the error occured to my error handeling procedure, any thoughts? ...
0
7274
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7323
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7453
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5005
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4670
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3162
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3151
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1507
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
732
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.