I have a postgresql function defined as follows ... DECLARE int_userid ALIAS FOR $1; BEGIN OPEN $2 FOR SELECT DISTINCT "users"."userloginid", "roles"."rolelike" FROM "roles" INNER JOIN "userpreferences" ON "roles"."roleid" = "userpreferences"."roleid" INNER JOIN "users" ON "userpreferences"."userid" = "users"."userid" WHERE "users"."userid" = int_userid AND "userpreferences"."userrolestatus"='a'; RETURN $2; close $2; END; This function takes two parameters - cursor and a valid integer, returns a cursor in parameter 1 In ASP page, I have the following code to reference this cursor and display information obtained. This code does not work ... I get page cannot be displayed error - HTTP 500 - Internal server error Internet Explorer what am I doing wrong? I am using 7.3.200 version of postgresql ODBC driver on an IIS server <html> <body> <% Dim STRCONN Dim sql Dim rs STRCONN = "Driver=PostgreSQL;Server=207.7.254.71;Port=5432;User Id=postgres;Password=postgres;Database=transpandit;" sql = "begin; select tp_get_userroles('rcursor', 5052); fetch all in rcursor; commit;" set rs = server.createobject("adodb.recordset") rs.open sql, STRCONN response.write(".." + sql + "<br>") FETCH rcursor INTO userloginid, rolelike reponse.write(userloginid + " - " + rolelike + "<br>") WHILE FETCH_STATUS = 0 FETCH rcursor INTO userloginid, rolelike reponse.write(userloginid + " - " + rolelike + "<br>") WEND CLOSE rcursor //While Not rs.EOF // response.write("<br>"&rs(0)) // response.write("<br>"&rs(1)) // // rs.MoveNext //Wend //rs.Close %> </body> </html> -- View this message in context: http://www.nabble.com/cursors-and-ASP-page-tf2430350.html#a6776250 Sent from the PostgreSQL - general mailing list archive at Nabble.com.