pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
vb6 inquiry
2+ messages / 2 participants
[nested] [flat]

* vb6 inquiry
@ 2005-10-12 19:34 Joseph Armbruster <josepharmbruster@gmail.com>
  2005-10-17 12:59 ` Re: vb6 inquiry Greg Campbell <greg.campbell@us.michelin.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Joseph Armbruster @ 2005-10-12 19:34 UTC (permalink / raw)
  To: pgsql-odbc

All,

I am working off of the vb6 sample given in the psqlODBC doc that
accompanies the odbc driver. My issue is, when I am displaying the
rs.Cursortype, it is reading 3, however this is not what was requested.
Shouldn't this be 2?

Thank You,
Joseph Armbruster

Dim cn As New adodb.Connection
Dim rs As New adodb.Recordset

cn.Open "DSN=test_post;UID=postgres;PWD=acupostgres;Database=vbtest"

rs.CursorType = adOpenDynamic
rs.LockType = adLockOptimistic
rs.CursorLocation = adUseServer
rs.Open "SELECT id, data FROM vbtest", cn, adOpenDynamic, adLockOptimistic

MsgBox "AdoEnums.CursorType.DYNAMIC = " & adodb.CursorTypeEnum.adOpenDynamic
MsgBox "rs.CursorType = " & rs.CursorType & vbCrLf & "rs.CursorLocation = "
& rs.CursorLocation

While Not rs.EOF
Debug.Print rs!id & ": " & rs!Data
rs.MoveNext
Wend

rs.AddNew
rs!id = 76
rs!Data = "More random data"

rs.Update

cn.Execute "INSERT INTO vbtest (id, data) VALUES (23, 'Some random data');"
rs.Update


If rs.State <> adStateClosed Then rs.Close
Set rs = Nothing
If cn.State <> adStateClosed Then cn.Close
Set cn = Nothing

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: vb6 inquiry
  2005-10-12 19:34 vb6 inquiry Joseph Armbruster <josepharmbruster@gmail.com>
@ 2005-10-17 12:59 ` Greg Campbell <greg.campbell@us.michelin.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Greg Campbell @ 2005-10-17 12:59 UTC (permalink / raw)
  To: Joseph Armbruster <josepharmbruster@gmail.com>; +Cc: pgsql-odbc

I was under the impression that psqlODBC does not support server side cursors. Therefore the correct way 
to retrieve data is to use a client side cursor (adUseClient). This is inline with a "disconnected" model 
that returns all the requested records immediately, instead of waiting for the client to cursor through 
them. This also is supposed to allow a more immediate release of the connection, ultimately providing 
greater scalability. (Is scalability still a buzz-word?).

BTW your sample specifies a LockType in two places. It's ok, but you don't really need that. I think the 
one on the rs.Open line is good enough.



Note:
adUseServer=2
adUseClient=3


Joseph Armbruster wrote:
> All,
> 
> I am working off of the vb6 sample given in the psqlODBC doc that
> accompanies the odbc driver. My issue is, when I am displaying the
> rs.Cursortype, it is reading 3, however this is not what was requested.
> Shouldn't this be 2?
> 
> Thank You,
> Joseph Armbruster
> 
> Dim cn As New adodb.Connection
> Dim rs As New adodb.Recordset
> 
> cn.Open "DSN=test_post;UID=postgres;PWD=acupostgres;Database=vbtest"
> 
> rs.CursorType = adOpenDynamic
> rs.LockType = adLockOptimistic
> rs.CursorLocation = adUseServer
> rs.Open "SELECT id, data FROM vbtest", cn, adOpenDynamic, adLockOptimistic
> 
> MsgBox "AdoEnums.CursorType.DYNAMIC = " & adodb.CursorTypeEnum.adOpenDynamic
> MsgBox "rs.CursorType = " & rs.CursorType & vbCrLf & "rs.CursorLocation = "
> & rs.CursorLocation
> 
> While Not rs.EOF
> Debug.Print rs!id & ": " & rs!Data
> rs.MoveNext
> Wend
> 
> rs.AddNew
> rs!id = 76
> rs!Data = "More random data"
> 
> rs.Update
> 
> cn.Execute "INSERT INTO vbtest (id, data) VALUES (23, 'Some random data');"
> rs.Update
> 
> 
> If rs.State <> adStateClosed Then rs.Close
> Set rs = Nothing
> If cn.State <> adStateClosed Then cn.Close
> Set cn = Nothing
> 

Attachments:

greg.campbell.vcf (text/x-vcard, 239B) download begin:vcard fn:Greg Campbell n:Campbell;Greg org:Michelin North America - US5 Lexington;ENG-ASE email;internet:greg.campbell@us.michelin.com title:ASE Systems Engineer tel;work:803-951-5561/x75561 x-mozilla-html:FALSE version:2.1 end:vcard
^ permalink raw reply [nested|flat] 2+ messages in thread


end of thread, other threads:[~2005-10-17 12:59 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-10-12 19:34 vb6 inquiry Joseph Armbruster <josepharmbruster@gmail.com>
2005-10-17 12:59 ` Greg Campbell <greg.campbell@us.michelin.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox