From: | "Adnan DURSUN" <a_dursun(at)hotmail(dot)com> |
---|---|
To: | "dodol garut" <jangkaru80(at)yahoo(dot)com>, <pgsql-odbc(at)postgresql(dot)org> |
Subject: | Re: Postgre and Visual Basic |
Date: | 2006-03-07 18:22:09 |
Message-ID: | BAY106-DAV200D06F5A485EBF7F81087FAEE0@phx.gbl |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-odbc |
----- Original Message -----
From: dodol garut
To: pgsql-odbc(at)postgresql(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Christian Paul B. Cosinas | 2006-03-08 08:11:53 | Re: [Polesoft Antispam]Re: Postgre and Visual Basic |
Previous Message | Daniel Holm | 2006-03-07 16:29:17 | MSSQL To PostgreSQL Via DTS |