Link to home
Start Free TrialLog in
Avatar of w3digital
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.


ASKER CERTIFIED SOLUTION
Avatar of kelvinwkw
kelvinwkw
Flag of Malaysia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
to assign an object to a variable you need to use SET

SET <variable> = object
Forgot to write down something that is needed

set rsData = getDataset("SELECT * FROM table")
Avatar of w3digital
w3digital

ASKER

Marvellous!

Thank you very much indeed!