From: Adnan DURSUN <a_dursun@hotmail.com>
To: dodol garut <jangkaru80@yahoo.com>
To: pgsql-odbc@postgresql.org
Subject: Re: Postgre and Visual Basic
Date: Tue, 7 Mar 2006 20:22:09 +0200
Message-ID: <BAY106-DAV200D06F5A485EBF7F81087FAEE0@phx.gbl> (raw)
References: <20060307144746.92130.qmail@web37601.mail.mud.yahoo.com>
<BAY106-DAV13793C1BA1C6D88481644FFAEE0@phx.gbl>
----- Original Message -----
From: dodol garut
To: pgsql-odbc@postgresql.org
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 Bilisim Ltd.
TURKEY
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: a_dursun@hotmail.com, jangkaru80@yahoo.com
Subject: Re: Postgre and Visual Basic
In-Reply-To: <BAY106-DAV200D06F5A485EBF7F81087FAEE0@phx.gbl>
References: <20060307144746.92130.qmail@web37601.mail.mud.yahoo.com> <BAY106-DAV13793C1BA1C6D88481644FFAEE0@phx.gbl> <BAY106-DAV200D06F5A485EBF7F81087FAEE0@phx.gbl>
* 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