Re: Postgre and Visual Basic - Mailing list pgsql-odbc

From Adnan DURSUN
Subject Re: Postgre and Visual Basic
Date
Msg-id BAY106-DAV200D06F5A485EBF7F81087FAEE0@phx.gbl
Whole thread Raw
In response to Postgre and Visual Basic  (dodol garut <jangkaru80@yahoo.com>)
List pgsql-odbc
 
----- Original Message -----
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=MSDASQL.1;Password=" & ConnSifre & ";Persist Security Info=True;UID=" & ConnUser & ";Data Source=" & ConnDataSource & ";DATABASE=" & ConnDataBase & ";SERVER=" & ConnServer & ""
    Set SetMyConn = MyConn
    SystemLogon = ""
 
    Exit Function
Hata:
    SystemLogon = 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 = 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 = New ADODB.Recordset
    MyRs.CursorLocation = adUseClient
    MyRs.Open pSQLStr, MyCurConn, adOpenStatic, adLockReadOnly
    Set ExecuteSQLReturnRowSet = MyRs
    Set MyRs = Nothing
End Function
I hope above samples helps to you...
 
Adnan DURSUN
ASRIN Bilişim Ltd.
TURKEY

pgsql-odbc by date:

Previous
From: "Campbell, Greg"
Date:
Subject: Re: Postgre and Visual Basic
Next
From: "Christian Paul B. Cosinas"
Date:
Subject: Re: [Polesoft Antispam]Re: Postgre and Visual Basic