473,651 Members | 2,917 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.CreateOb ject("SPP.DBInt erface")
Set rs = Server.CreateOb ject("ADODB.Rec ordset")
Set objDictionary = Server.CreateOb ject("Scripting .Dictionary")

sql = strSQL

objDBInterface. sql = sql
Set rs = objDBInterface. SelectSQL

' add rs to dictionary
for each field in rs.Fields
objDictionary.I tem(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 6439
Set ExecSQL = objDictionary
--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"JT" <je******@sppin c.net> wrote in message
news:uR******** ******@tk2msftn gp13.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.CreateOb ject("SPP.DBInt erface")
Set rs = Server.CreateOb ject("ADODB.Rec ordset")
Set objDictionary = Server.CreateOb ject("Scripting .Dictionary")

sql = strSQL

objDBInterface. sql = sql
Set rs = objDBInterface. SelectSQL

' add rs to dictionary
for each field in rs.Fields
objDictionary.I tem(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
7045
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 Complete() sub. This is within a page that will take me quite a while to test, so I'd like to know if I've got this right beforehand. I think I'm missing something...but not sure what? Never used this before in this way. ...within a Sub...
4
2404
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 code that creates an XML Doc and adds a field/element to it? Thanx! -- TFWBWY...A
2
1784
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 << "blaster01,1,0,...,0,0,20,0,0,20,eol"; At the end of the method it does:
5
1907
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
19150
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 understand it. I've attached my code below to see if anything looks funny. It happens at the very last return at the end. Thanks in advance, --melih ===========Code========
6
1839
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= >>> d.append((56,4)) >>> d >>> s = >>> for i, j in enumerate(d): ... for k, l in enumerate(j):
4
1932
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 but I'm not sure why the function does not work for this part. Does anyone have any suggestions/scripts that would work in this case? I am working with javascript, ASP files and html.
1
3933
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 function is returning an Integer with a value of 1. Err.number =5 Err.Description=Operation is not supported on this platform. Err.Source=System.Web Anyone ever seen this error or can explain why I am getting this? Thanks,
2
1636
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? Andrew
0
8277
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8803
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8700
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8465
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8581
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6158
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4285
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2701
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 we have to send another system
2
1588
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.