X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8E48C32A103 for ; Wed, 6 Oct 2004 22:51:03 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 62074-04 for ; Wed, 6 Oct 2004 21:50:55 +0000 (GMT) Received: from prata.proservvi.com.br (unknown [200.232.120.179]) by svr1.postgresql.org (Postfix) with ESMTP id DEC9432A410 for ; Wed, 6 Oct 2004 22:50:48 +0100 (BST) Received: from localhost (localhost.localdomain [127.0.0.1]) by prata.proservvi.com.br (Postfix) with ESMTP id 304403B2E0 for ; Wed, 6 Oct 2004 18:50:10 -0300 (BRT) Received: from sandroyy (unknown [192.168.20.148]) by prata.proservvi.com.br (Postfix) with SMTP id 726593B2DF for ; Wed, 6 Oct 2004 18:50:08 -0300 (BRT) Message-ID: <006501c4abee$db91d430$9414a8c0@proservvi.com.br> From: "Sandro Yaqub Yusuf" To: Subject: Using VISUAL BASIC with POSTGRESQL - Part One Date: Wed, 6 Oct 2004 18:53:04 -0300 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0062_01C4ABD5.B5FD32F0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Virus-Scanned: by AMaViS 0.3.12pre8 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.4 tagged_above=0.0 required=5.0 tests=HTML_70_80, HTML_MESSAGE, UPPERCASE_25_50 X-Spam-Level: X-Archive-Number: 200410/66 X-Sequence-Number: 4541 This is a multi-part message in MIME format. ------=_NextPart_000_0062_01C4ABD5.B5FD32F0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hello my dear friends...=20 =20 I swallow one more collaboration to help those that as I want to use the VI= SUAL BASIC integrated with PostGresQL.=20 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.=20 =20 1 - To do a simple SELECT with PARAMETER in the DATABASE returning all of t= he ROWS and COLUMNS of the table USER, make the following:=20 =20 In POSTGRESQL 8: =20 CREATE OR REPLACE FUNCTION sp_user_search(int2) RETURNS SETOF user AS $BODY$ SELECT * FROM user WHERE iduser =3D $1; $BODY$ LANGUAGE SQL; =20 =20 In VISUAL BASIC 6 using ADO 2.8: =20 Dim adoBD As ADODB.Connection Dim rsTB As New ADODB.Recordset Set adoBD =3D New ADODB.Connection adoBD.ConnectionString =3D "driver=3DPostgreSQL};server=3Dlocalhost;databas= e=3DSICCEV;port=3D5432;uid=3Dryan;pwd=3Ddisplace;" adoBD.Open Set rsTB =3D adoBD.Execute("select * from sp_user_search('1');") Do While Not rsTB.EOF MsgBox tb!iduser & " - " & tb!user & " - " & tb!password & " - " & tb= !fullname =20 rsTB.MoveNext Loop rsTB.Close adoBD.Close =20 RESULT OF EXECUTION: 1 - Sandro - 123 - Sandro Yaqub Yusuf Coming soon: making INSERT in the DATABASE... =20 Sandroyy ------=_NextPart_000_0062_01C4ABD5.B5FD32F0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable

Hello my dear friends... =

 

I swallow one more collaboration to help= those=20 that as I want to use the VISUAL BASIC integrated with PostGresQL. <= /P>

Once again I want to thank to all o= f this=20 FORUM that directly or indirectly they help me with you doubt them that I h= ave=20 correspondent.

 

1 - To do a simple SELECT with PARAMETER= in=20 the DATABASE returning all of the ROWS and COLUMNS of the table U= SER,=20 make the following:

 

 

In= =20 POSTGRESQL 8:

 

CRE= ATE OR=20 REPLACE FUNCTION sp_user_search(int2)
 =20 RETURNS SETOF user AS $BODY$

&nb= sp;=20 SELECT * FROM user WHERE iduser =3D $1;

$BO= DY$
 =20 LANGUAGE SQL;

 

 

In = VISUAL=20 BASIC 6 using ADO= =20 2.8:

 

Dim= adoBD=20 As ADODB.Connection
Dim rsTB    As New=20 ADODB.Recordset

Set adoBD =3D New=20 ADODB.Connection

adoBD.ConnectionString=20 =3D "driver=3DPostgreSQL};server=3Dlocalhost;database=3DSICCEV;port=3D= 5432;uid=3Dryan;pwd=3Ddisplace;"
adoBD.Open

Set=20 rsTB =3D adoBD.Execute("select * from sp_user_search
('1');")

Do=20 While Not rsTB.EOF
      MsgBox tb!iduser &= " -=20 " & tb!user & " - " & tb!password & " - " &=20 tb!fullname

 

&nb= sp;    =20 rsTB.MoveNext
Loo= p

 

rsT= B.Close
adoBD.Close

 

 

RES= ULT OF=20 EXECUTION: 1 = -=20 Sandro - 123 - Sandro Yaqub Yusuf

 

Com= ing=20 soon: ma= king=20 INSERT in the DATABASE...

 

 

San= droyy

 

------=_NextPart_000_0062_01C4ABD5.B5FD32F0--