Re: SPAM-LOW: cursors and ASP page - Mailing list pgsql-general

From William Penberthy
Subject Re: SPAM-LOW: cursors and ASP page
Date
Msg-id !&!AAAAAAAAAAAYAAAAAAAAAAGZJtg+Hf1OimjKwiCyfgjCgAAAEAAAAJL+cukztIdNn4XVycT5Q8kBAAAAAA==@scarpatechnology.com
Whole thread Raw
In response to cursors and ASP page  (ANJANE <softwaredesigns@hotmail.com>)
List pgsql-general

1)  Make sure that your browser is set to display full errors, and not
"Friendly HTTP Error Messages" - that should allow you to see where and what
is breaking.

2)  Your ASP code is referencing rcursor, but that construct is strictly
within the SQL and not visible to scripting language.  Try using your
recordset (rs) instead and see if that changes anything.

3)  I am not sure how ODBC handles the conversion of cursor into a
recordset.  I personally think it will make choking sounds and collapse,
but...

Bill Penberthy
Scarpa Technology, Inc.

-----Original Message-----
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org] On Behalf Of ANJANE
Sent: Thursday, October 12, 2006 7:31 AM
To: pgsql-general@postgresql.org
Subject: SPAM-LOW: [GENERAL] cursors and ASP page


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.


---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to majordomo@postgresql.org so that your
       message can get through to the mailing list cleanly



pgsql-general by date:

Previous
From: Andrew Sullivan
Date:
Subject: Re: STABLE functions
Next
From: Michelle Konzack
Date:
Subject: Re: Storing images in PostgreSQL databases (again)