I'm currently starting to develop a new application under VB6 using ADO for
connectivity and I had selected pgSQL because until MySQL 4.1 doesn't
support transactions and stored procedures on a stable version, in other
words, on a production version. I come from developing on MS SQL Server
where you can execute stored procedures and capture the result set in a
recordset object. In the following link you may see what I'm pursuing to do
with pgSQL:
http://www.asp101.com/articles/wrox/asp30/26100903.asp
So far I've created a function under pgSQL which I've been able to call from
VB utilizing an SQL pass-through statement using an ADO Recordset object.
Unfortunately, the returning recordset comes with only one field when it
should return several fields and it's the value is a string with comma
separated values which corresponds to the database fields in the original
query. Below you will see the output that I get:
(4,"hospital el rosario",her,"j97761200 ",,,,t,t,1,"2005-06-16
15:05:44.463",1,"2005-06-16 15:05:44.463")
As follow. I'm going to include the VB call snippet and the pl/pgSQL
function:
DIM m_rst As ADODB.Recordset
Set m_rst = New ADODB.Recordset
m_rst.LockType = adLockReadOnly
m_rst.CursorType = adOpenStatic
m_rst.CursorLocation = adUseClient
Set m_rst = m_cnn.Execute("SELECT up_sel_empresas()")
Debug.Print m_rst.Fields(0).Value
CREATE OR REPLACE FUNCTION up_sel_empresas()
RETURNS SETOF "vw_Empresas" AS
$BODY$
SELECT *
FROM "vw_Empresas"
WHERE "EdoRegistro" = true;
$BODY$
LANGUAGE 'sql' VOLATILE;
What I'm trying to get is a collection of fields like I get when I call sp's
under MS SQL Server or MySQL 5.0.
I'll appreciate very much any help on how to accomplish my goal.
Thanks in advance,
James Shaw
Venezuela