Function Returns RecordSet Object

Results 1 to 2 of 2

Thread: Function Returns RecordSet Object

  1. #1
    Join Date
    Dec 1969

    Default Function Returns RecordSet Object

    How can I create a user defined function in asp that returns a RecordSet Object, and I can apply Fields([index]) method on it after receiving that from the calling program. please help me.

  2. #2
    Join Date
    Dec 1969

    Default This is better off in the ASP forum, but...

    ...anyway. I don&#039;t quite understand what you mean. Do you mean this?<BR><BR>Function ReturnRecordSet(sConnection, sSQL)<BR><BR>Dim Connection, RecordSet<BR><BR>Set Connection = Server.CreateObject("ADODB.Connection")<BR>Connect ion.Open sConnection<BR>Set RecordSet = Server.CreateObject("ADODB.Recordset")<BR>RecordSe t.Open sSQL, sConnection<BR><BR>ReturnRecordSet = RecordSet<BR><BR>End Function<BR><BR>As you can see, you need to pass it the connection string and the SQL statement. It&#039;s just going to be a bit difficult to close the connection later, since you don&#039;t have direct access to it.<BR><BR>What are you trying to achieve?<BR><BR>Oliver.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts