Thread: Postgre and Visual Basic
i need a sample of Visual Basic Project with PostgreSQL, anyone can help me?
Trim's
ERIS RISO
Indonesia
Send instant messages to your online friends http://uk.messenger.yahoo.com
Are you having trouble connecting from VB? I have declared and ODBC DSN "pgresearch" via ADO and used that: Dim gcnResearch As ADODB.Connection Dim rsUId As ADODB.Recordset ' open the database Set gcnResearch = New ADODB.Connection With gcnResearch .ConnectionString = "dsn=pgresearch" .Properties("User ID") = txtUsername .Properties("Password") = txtPassword .Open End With Tim Clarke -----Original Message----- From: pgsql-odbc-owner@postgresql.org [mailto:pgsql-odbc-owner@postgresql.org] On Behalf Of dodol garut Sent: 07 March 2006 14:48 To: pgsql-odbc@postgresql.org Subject: [ODBC] Postgre and Visual Basic i need a sample of Visual Basic Project with PostgreSQL, anyone can help me? Trim's ERIS RISO Indonesia Send instant messages to your online friends http://uk.messenger.yahoo.com
----- Original Message -----From: dodol garutSent: Tuesday, March 07, 2006 4:47 PMSubject: [ODBC] Postgre and Visual Basic>i need a sample of Visual Basic Project with PostgreSQL, anyone can help me?>Trim'sWhat do you need ?Adnan DURSUN
ASRIN Bilişim Ltd.TURKEY
To debug this sort of issue, take VB out of the picture: once it has processed the line creating StrSql2 for you, run the SQL directly in Postgres via some other method (we use pgAdmin) and make sure that code is OK. Then you'll know whether this is a VB or a Postgres issue. Tim Clarke -----Original Message----- From: dodol garut [mailto:jangkaru80@yahoo.com] Sent: 07 March 2006 15:24 To: Tim Clarke Subject: Re: [ODBC] Postgre and Visual Basic When I insert a reccord from my form in VB, there was an error message "no columns defined in rowset" and here is my query to insert that reccord: dim StrSql2 as string StrSql2 = "insert into produk(kodeproduk,namaproduk,hargasatuan) values('" & text1.Text & "','" & Text2.Text & "'," & Text3.Text & ");" project.dbScholl.Execute StrSql2 , , adCmdText thanx before...
> project.dbScholl.Execute StrSql2 , , adCmdText First, test the SQL statement in something like the SQL window of pgAdmin. Then Is dbScholl a database object (like DAO) or an ADODB.Connection object? You should understand the difference and select one. Presuming that you really want ADO, Are you using liked tables? .. If so then use something like CurrentProject.Connection.Execute StrSql2 If not linked tables then use something like Dim cnn as new ADODB.Connection cnn.Open "DSN=my_dbs_dsn_name" 'or a full PostgreSQL connection string to save a trip to the registry cnn.Execute StrSql2 Tim Clarke wrote: > To debug this sort of issue, take VB out of the picture: once it has > processed the line creating StrSql2 for you, run the SQL directly in > Postgres via some other method (we use pgAdmin) and make sure that code > is OK. Then you'll know whether this is a VB or a Postgres issue. > > Tim Clarke > > -----Original Message----- > From: dodol garut [mailto:jangkaru80@yahoo.com] > Sent: 07 March 2006 15:24 > To: Tim Clarke > Subject: Re: [ODBC] Postgre and Visual Basic > > > When I insert a reccord from my form in VB, there was an error message > "no columns defined in rowset" > > and here is my query to insert that reccord: > dim StrSql2 as string > StrSql2 = "insert into produk(kodeproduk,namaproduk,hargasatuan) > values('" & text1.Text & "','" & Text2.Text & "'," & Text3.Text & ");" > > project.dbScholl.Execute StrSql2 , , adCmdText > > thanx before... > > ---------------------------(end of broadcast)--------------------------- > TIP 1: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly
Attachment
----- Original Message -----From: dodol garutSent: Tuesday, March 07, 2006 4:47 PMSubject: [ODBC] Postgre and Visual Basic>i need a sample of Visual Basic Project with PostgreSQL, anyone can help me?>Trim'sThis 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 FunctionThis 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 FunctionThis 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.RecordsetMyRs.CursorLocation = adUseClient
MyRs.Open pSQLStr, MyCurConn, adOpenStatic, adLockReadOnly
Set ExecuteSQLReturnRowSet = MyRs
Set MyRs = Nothing
End FunctionI hope above samples helps to you...Adnan DURSUN
ASRIN Bilişim Ltd.TURKEY
Just use ODBC Connection to interface Visual Basic and PostgreSQL
From: pgsql-odbc-owner@postgresql.org [mailto:pgsql-odbc-owner@postgresql.org] On Behalf Of Adnan DURSUN
Sent: Tuesday, March 07, 2006 7:03 AM
To: dodol garut; pgsql-odbc@postgresql.org
Subject: [Polesoft Antispam]Re: [ODBC] Postgre and Visual Basic
----- Original Message -----
From: dodol garut
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
What do you need ?
Adnan DURSUN
ASRIN Bilişim Ltd.TURKEY
I choose Polesoft Lockspam to fight spam, and you?
http://www.polesoft.com/refer.html