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@postgresql.org)