From: Sandro Yaqub Yusuf <sandro@proservvi.com.br>
To: pgsql-odbc@postgresql.org
Subject: Using VISUAL BASIC with POSTGRESQL - Part One
Date: Wed, 6 Oct 2004 18:53:04 -0300
Message-ID: <006501c4abee$db91d430$9414a8c0@proservvi.com.br> (raw)
Hello my dear friends...
I swallow one more collaboration to help those that as I want to use the VISUAL BASIC integrated with PostGresQL.
Once again I want to thank to all of this FORUM that directly or indirectly they help me with you doubt them that I have correspondent.
1 - To do a simple SELECT with PARAMETER in the DATABASE returning all of the ROWS and COLUMNS of the table USER, make the following:
In POSTGRESQL 8:
CREATE OR REPLACE FUNCTION sp_user_search(int2)
RETURNS SETOF user AS $BODY$
SELECT * FROM user WHERE iduser = $1;
$BODY$
LANGUAGE SQL;
In VISUAL BASIC 6 using ADO 2.8:
Dim adoBD As ADODB.Connection
Dim rsTB As New ADODB.Recordset
Set adoBD = New ADODB.Connection
adoBD.ConnectionString = "driver=PostgreSQL};server=localhost;database=SICCEV;port=5432;uid=ryan;pwd=displace;"
adoBD.Open
Set rsTB = adoBD.Execute("select * from sp_user_search('1');")
Do While Not rsTB.EOF
MsgBox tb!iduser & " - " & tb!user & " - " & tb!password & " - " & tb!fullname
rsTB.MoveNext
Loop
rsTB.Close
adoBD.Close
RESULT OF EXECUTION: 1 - Sandro - 123 - Sandro Yaqub Yusuf
Coming soon: making INSERT in the DATABASE...
Sandroyy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-odbc@postgresql.org
Cc: sandro@proservvi.com.br
Subject: Re: Using VISUAL BASIC with POSTGRESQL - Part One
In-Reply-To: <006501c4abee$db91d430$9414a8c0@proservvi.com.br>
References: <006501c4abee$db91d430$9414a8c0@proservvi.com.br>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox