Re: VB functions for postgres

From: "Mike Miller" <mike(at)psy(dot)otago(dot)ac(dot)nz>
To: <raymond(dot)chuasing(at)kasal(dot)com>, <pgsql-odbc(at)postgresql(dot)org>
Subject: Re: VB functions for postgres
Date: 2003-02-19 09:57:34
Message-ID: 000001c2d7fd$543c7060$1bf014ac@gwain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

-----Original Message-----

<SNIP>

> MyConn.Open "DSN=PostgreSQL", "Mondi", "1234"
> Set rs = New ADODB.Recordset
> rs.Open "select * from userinfo;", Myconn, adOpenDynamic
> then I use the Myconn.execute to execute some sql querries
>
> Heres the prob:
> - I don't know how to navigate thru the recordset

Try something like this. It will get you started ;)
Write back if you have trouble.

Set rsInfo = New ADODB.Recordset

With rsInfo

.CursorType = adOpenStatic
.LockType = adLockReadOnly
.ActiveConnection = adoConnection
.Open "select Name, Description from userinfo"

' Make sure there are records
If Not .BOF And Not .EOF Then

' Move to the first record
.MoveFirst

' While not at the end (there are more records)
While Not .EOF

' Do stuff with row
Debug.Print .Fields("Name").Value
Debug.Print .Fields("Description").Value

' DoEvents so that app doesn't hang and move to
the next record
DoEvents
.MoveNext

Wend

End If

' Close the recordset
.Close

End With

--
Mike Miller,
Computer Programmer,
Department of Pyschology,
University Of Otago
mike(at)psy(dot)otago(dot)ac(dot)nz
+64 3 479 5402

...when you lay awake at night hoping that those elves from "The Elves
and the Shoemaker" know where you work and can program in C++ as well as
they can sew together sandles...
-- stolen from (http://www.gameai.com/youknow.html)

In response to

Browse pgsql-odbc by date

  From Date Subject
Next Message Marcus Better 2003-02-20 09:40:38 Unicode, ODBC and MS Access
Previous Message raymond.chuasing 2003-02-19 09:29:07 VB functions for postgres