w3digital
asked on
Can I use a function to return a recordset in classic ASP
I've recently switched from ASP to ASP.NET but I currently working on site that uses ASP.
In .NET I can use a DAL layer class and return a dataset to an object. I'm trying to do the same in ASP.
So, forgetting the classes etc and simplifying the matter I basically just need something like:
rsData = getDataset("SELECT * FROM table")
If Not rsData.Eof Then
'Do my thing...
End If
Public Function getDataset(strSQL)
getDataset = DBConn.Execute(strSQL)
End Function
I get "Object doesn't support this property or method: 'Eof'" so I guess I can't return a dataset.
In .NET I can use a DAL layer class and return a dataset to an object. I'm trying to do the same in ASP.
So, forgetting the classes etc and simplifying the matter I basically just need something like:
rsData = getDataset("SELECT * FROM table")
If Not rsData.Eof Then
'Do my thing...
End If
Public Function getDataset(strSQL)
getDataset = DBConn.Execute(strSQL)
End Function
I get "Object doesn't support this property or method: 'Eof'" so I guess I can't return a dataset.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Forgot to write down something that is needed
set rsData = getDataset("SELECT * FROM table")
set rsData = getDataset("SELECT * FROM table")
ASKER
Marvellous!
Thank you very much indeed!
Thank you very much indeed!
SET <variable> = object