returning a a recordset from a function in ASP CLASSIC

Sebi94

New Member
i would like to make some functions that returns a working recordset from a database.the problem is... it seams that since i use the recordset within the function, is all ok, when i try to assign it to another recordset object... everything goes wrong:this is the function i have made:\[code\]public function DBInteract()Set conn = Server.CreateObject("ADODB.Connection")conn.Open "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=third.server.com; DATABASE=DB_name; UID=DB_user;PASSWORD=DB_pass; OPTION=3"Set rsfetch = Server.CreateObject("ADODB.Recordset")set rsfetch = conn.Execute ("SELECT * FROM tb_utenti")set DBInteract = rsfetchset rsfetch = nothing'close recordset or set it as nothing'DO NOT Close the connectionend function\[/code\]i call the function with : \[code\]on error resume nextset rs = DBInteract()response.write(rs.recordcount)If Err.Number <> 0 ThenResponse.write(Err.Number)response.write("<br>")response.write(Err.description)end if\[/code\]and this is what it returns:\[code\]-1\[/code\]please help me on this... thanks in advance.
 
Back
Top