J
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
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