| From: | "James Shaw" <shawjh(at)msn(dot)com> | 
|---|---|
| To: | pgsql-novice(at)postgresql(dot)org | 
| Cc: | gaular(at)gmail(dot)com | 
| Subject: | VB6, ADO with pgSQL | 
| Date: | 2005-06-16 21:37:05 | 
| Message-ID: | BAY102-F38084DE08E1B72E4AC851CAF50@phx.gbl | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-novice | 
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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Matt Iskra | 2005-06-16 22:56:31 | Trigger and Trigger function. | 
| Previous Message | Jeffrey Melloy | 2005-06-16 18:39:48 | Re: Library Framework |