X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C8A699DC889 for ; Tue, 7 Mar 2006 14:52:32 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 05020-04 for ; Tue, 7 Mar 2006 14:52:31 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from hotmail.com (bay106-dav20.bay106.hotmail.com [65.54.161.92]) by postgresql.org (Postfix) with ESMTP id 276559DC97A for ; Tue, 7 Mar 2006 14:22:32 -0400 (AST) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Tue, 7 Mar 2006 10:22:32 -0800 Message-ID: Received: from 85.105.24.123 by BAY106-DAV20.phx.gbl with DAV; Tue, 07 Mar 2006 18:22:30 +0000 X-Originating-IP: [85.105.24.123] X-Originating-Email: [a_dursun@hotmail.com] X-Sender: a_dursun@hotmail.com From: "Adnan DURSUN" To: "dodol garut" , References: <20060307144746.92130.qmail@web37601.mail.mud.yahoo.com> Subject: Re: Postgre and Visual Basic Date: Tue, 7 Mar 2006 20:22:09 +0200 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_00A1_01C64224.CF79A6F0" 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-OriginalArrivalTime: 07 Mar 2006 18:22:32.0059 (UTC) FILETIME=[197624B0:01C64214] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=2.034 required=5 tests=[AWL=-0.162, DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44, HTML_MESSAGE=0.001, MAILTO_TO_SPAM_ADDR=0.276, MSGID_FROM_MTA_HEADER=0] X-Spam-Score: 2.034 X-Spam-Level: ** X-Archive-Number: 200603/41 X-Sequence-Number: 7327 This is a multi-part message in MIME format. ------=_NextPart_000_00A1_01C64224.CF79A6F0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable ----- Original Message -----=20 From: dodol garut=20 To: pgsql-odbc@postgresql.org=20 Sent: Tuesday, March 07, 2006 4:47 PM Subject: [ODBC] Postgre and Visual Basic >i need a sample of Visual Basic Project with PostgreSQL, anyone can = help me? >Trim's This Sample function make a connection to database : = -------------------------------------------------------------------------= ------------ Public Function SystemLogon() As String Dim MyConn As New ADODB.Connection, myDSN As String, Rs As = Object On Error GoTo Hata MyConn.Open "Provider=3DMSDASQL.1;Password=3D" & ConnSifre & = ";Persist Security Info=3DTrue;UID=3D" & ConnUser & ";Data Source=3D" & = ConnDataSource & ";DATABASE=3D" & ConnDataBase & ";SERVER=3D" & = ConnServer & "" Set SetMyConn =3D MyConn SystemLogon =3D "" Exit Function Hata: SystemLogon =3D MyConn.Errors(0).Description End Function This Sample function executes a string (update,insert,delete) and = returns number of effected rows : = -------------------------------------------------------------------------= ----------- Public Function ExecuteSQL(pSQLStr As String) As Long Dim AffectedRecords As Long MyCurConn.Execute pSQLStr, AffectedRecords, adCmdText ExecuteSQL =3D AffectedRecords End Function This Sample function executes a string (select) and returns a = ADODB.recordset : = -------------------------------------------------------------------------= ---------------------------------------------- Public Function ExecuteSQLReturnRowSet(pSQLStr As String) As = ADODB.Recordset Dim MyRs As ADODB.Recordset Set MyRs =3D New ADODB.Recordset MyRs.CursorLocation =3D adUseClient MyRs.Open pSQLStr, MyCurConn, adOpenStatic, adLockReadOnly Set ExecuteSQLReturnRowSet =3D MyRs Set MyRs =3D Nothing End Function I hope above samples helps to you... Adnan DURSUN ASRIN Bilisim Ltd. TURKEY ------=_NextPart_000_00A1_01C64224.CF79A6F0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
 
----- Original Message -----
From:=20 dodol=20 garut
Sent: Tuesday, March 07, 2006 = 4:47=20 PM
Subject: [ODBC] Postgre and = Visual=20 Basic

>i need a sample of Visual Basic Project with PostgreSQL, = anyone can=20 help me?
>Trim's
 
 This Sample = function make a=20 connection to database=20 = :
--------------------------------------------------------------------= -----------------
Public Function SystemLogon() As=20 String
    Dim MyConn As New ADODB.Connection, = myDSN As=20 String, Rs As Object
    On Error GoTo=20 Hata
    MyConn.Open = "Provider=3DMSDASQL.1;Password=3D" &=20 ConnSifre & ";Persist Security Info=3DTrue;UID=3D" & = ConnUser &=20 ";Data Source=3D" & ConnDataSource & ";DATABASE=3D" & = ConnDataBase=20 & ";SERVER=3D" & ConnServer & ""
    = Set=20 SetMyConn =3D MyConn
    SystemLogon =3D = ""
 
    Exit=20 Function
Hata:
    SystemLogon =3D=20 MyConn.Errors(0).Description
End Function
This Sample = function executes a=20 string (update,insert,delete) and returns number of effected rows=20 = :
--------------------------------------------------------------------= ----------------
 
Public Function = ExecuteSQL(pSQLStr As=20 String) As Long
    Dim AffectedRecords As=20 Long
    MyCurConn.Execute pSQLStr, = AffectedRecords,=20 adCmdText
    ExecuteSQL =3D = AffectedRecords
End=20 Function
 
This Sample function executes = a string=20 (select) and returns a ADODB.recordset :
----------------------------------------------------------------= -------------------------------------------------------

Public Function=20 ExecuteSQLReturnRowSet(pSQLStr As String) As=20 ADODB.Recordset
    Dim MyRs As=20 ADODB.Recordset
    Set MyRs =3D New=20 ADODB.Recordset
    = MyRs.CursorLocation =3D=20 adUseClient
    MyRs.Open pSQLStr, MyCurConn,=20 adOpenStatic, adLockReadOnly
    Set=20 ExecuteSQLReturnRowSet =3D MyRs
    Set MyRs =3D=20 Nothing
End Function
I hope above samples helps to you...
 
Adnan DURSUN
ASRIN Bilişim Ltd.
TURKEY
------=_NextPart_000_00A1_01C64224.CF79A6F0--