|
|
![]() |
| Thread Tools | Search this Thread |
#1
| |||
| |||
How to return a recordset from a function in ASP hi, Actually, I need to return a recordset from a function in ASP program code. But don't know how to do the same. Can anybody please suggest a correct way of returning a recordset from a function in ASP ? thanks |
#2
| |||
| |||
Re: How to return a recordset from a function in ASP I had the same problem where I used the following technique: Create a function i.e. GetRecordSet and pass the sql string and the DSN string for flexibility. ALthough function doesnt return a recordset, but it returns an array which you can get with getrows. This technique is really fast and works well too. With this way, you can pass any kind of sql search statement and your return value would be an array representation of the resulting recordset. Also, you can open and close the DB connection and the recordset within the function itself. |
#3
| |||
| |||
Re: How to return a recordset from a function in ASP setup a temporary Recordset. use this to open and gather information as you would normally. Then when your are ready, set your function equal to the tmp recordset and kill the the temp one....like in following example: Public Function myFunction(var1,var1.....) as ADODB.Recordset Dim myRS 'Open RS etc.. myRS.open sSQL, dbConn 'If Open then set myFunction = myRS If not myRS is nothing then set myRs = nothing End if End Function |
#4
| |||
| |||
Re: How to return a recordset from a function in ASP you can also use the name of the function directly as it can be use inside itself as a variable of the type it returns - in this case, an ADODB.Recordset. |
![]() |
|
Tags: asp, function, recordset, return |
Thread Tools | Search this Thread |
|
![]() | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
SSH return function | Elizabeth Allen | Networking & Security | 5 | 22-04-2010 02:38 PM |
Is it possible for a function to return two values? | hounds | Software Development | 5 | 13-03-2010 07:51 PM |
How can I return different class in one function? | Madaleno | Software Development | 4 | 10-02-2010 09:45 PM |
Return string from a function in C | Samarth | Software Development | 3 | 28-12-2009 12:24 PM |
How to return an array from function | Rilex | Software Development | 3 | 02-10-2009 09:18 AM |