From: | "Andrea Aime" <aaime(at)comune(dot)modena(dot)it> |
---|---|
To: | Pat M <pmeloy(at)removethispart(dot)home(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: VB 6 pro to postgres suggestion needed |
Date: | 2001-10-03 06:42:15 |
Message-ID: | 3BBAB347.1E661812@comune.modena.it |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
You should use ADO objects, in particular ADO.Connection and
ADO.recordset, maybe also ADO.Command. Connection represents
a connection to the database and can execute queries and transactions,
Recordset can be thought as a cursor. The you can bind it directly
to visual controls... something like this:
Private conn As ADODB.Connection
Private rec As ADODB.Recordset
Private Sub Form_Load()
Set conn = New Connection
conn.CursorLocation = adUseClient
conn.ConnectionString = "DSN=PersonDatabase"
conn.Open
Set rec = conn.Execute("SELECT name, surname FROM person")
Set txtName.DataSource = rec
Set txtName.DataField = "name"
Set txtSurname.DataChanged = rec
Set txtSurname.DataField = "surname"
' If you want to move to the next record of you "cursor"
rec.MoveNext
' If you want to move to the previous record of your "cursor"
rec.MovePrevious
End Sub
Of course you should install the ODBC driver, set a Data Source Name
in ODBC properties and reference ADO from your project.
Hope this helps
Andrea Aime
Pat M wrote:
>
> I have scads of documentation on how to connect to and use databases with
> VB. Problem is, there's TOO much damned information. Appears that there is
> about 9,932,234.3 methods available.
>
> Can anyone suggest what method would be the closest to just using SQL and
> not having all these stupid widgety in the way? Something that would act
> more like the pg functions of PHP (pg_connect, pg_exec, that sort of thing)
> instead of making me bind databases and tables to little push buttony kludgy
> MS junk...
>
> Oh yes, I'm aiming for a pure client/server - no activex middle tiers or
> anything like that.
>
> I have the docs so don't feel obligated to try and explain the whole
> process. just point me and I'll read 8)
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
From | Date | Subject | |
---|---|---|---|
Next Message | zammon@libero.it | 2001-10-03 09:05:27 | Re: Alter table Add Primary Key |
Previous Message | Dave Harkness | 2001-10-03 02:37:40 | PROBLEM SOLVED: LOCK TABLE oddness in PLpgSQL function called via JDBC |