pg.ddx.io pgsql-odbc@postgresql.org mailing list archive
help / color / mirror / Atom feedVBA 6 crashes with WIN2K, Postgres 8.1, why ? which dll ??
14+ messages / 4 participants
[nested] [flat]
* VBA 6 crashes with WIN2K, Postgres 8.1, why ? which dll ??
@ 2006-01-06 04:12 linuxgps <linuxgps@invitel.hu>
0 siblings, 2 replies; 14+ messages in thread
From: linuxgps @ 2006-01-06 04:12 UTC (permalink / raw)
To: pgsql-odbc
Hi all,
I'm a beginner to MS Windows.
I began to to test VBA 6.0(SP6) with Postgresql 8.1 -with odbc- on
WIN2K(SP4).
For the test (accessing postgres db thru visual basic) I use the code,
given by the distro (psqlODBC HOWTO- Visual Basic).
The first problem I've encounted that the code in the given test snippet
is not full functioning:
"rs.Refresh" doesn't implemented ?
I use in the "Project Preferences" "Microsoft ActiveXData Objects 2.1
library (msado21.tlb)
I've installed some other MS stuff on the machine, and now the Postgres
database call makes a memory exception and crashes.
Q 1.: Is this general, or some libraries are wrong on my system ?
Q 2.: Which MS tools are to control/update the msado-libraries
Q.3.: Which msado or similars are necessary to connect with visual basic
to postgres ?
thank you in advance
testuser vba
-----------------
Sub Main()
Dim cn as New ADODB.Connection
Dim rs as New ADODB.Recordset
'Open the connection
cn.Open "DSN=<MyDataSourceName>;" & _
"UID=<MyUsername>;" & _
"PWD=<MyPassword>;" & _
"Database=<MyDatabaseName>"
'For updateable recordsets we would typically open a Dynamic recordset.
'Forward Only recordsets are much faster but can only scroll forward and
'are read only. Snapshot recordsets are read only, but scroll in both
'directions.
rs.Open "SELECT id, data FROM vbtest", cn, adOpenDynamic
'Loop though the recordset and print the results
'We will also update the accessed column, but this time access it through
'the Fields collection. ISO-8601 formatted dates/times are the safest IMHO.
While Not rs.EOF
Debug.Print rs!id & ": " & rs!data
rs.Fields("accessed") = Format(Now, "yyyy-MM-dd hh:mm:ss")
rs.Update
rs.MoveNext
Wend
'Add a new record to the recordset
rs.AddNew
rs!id = 76
rs!data = 'More random data'
rs!accessed = Format(Now, "yyyy-MM-dd hh:mm:ss")
rs.Update
'Insert a new record into the table
cn.Execute "INSERT INTO vbtest (id, data) VALUES (23, 'Some random data');"
'Refresh the recordset to get that last record...
rs.Refresh
'Get the record count
rs.MoveLast
rs.MoveFirst
MsgBox rs.RecordCount & " Records are in the recordset!"
'Cleanup
If rs.State <> adStateClosed Then rs.Close
Set rs = Nothing
If cn.State <> adStateClosed Then cn.Close
Set cn = Nothing
End Sub
^ permalink raw reply [nested|flat] 14+ messages in thread
* VBA 6 crashes with WIN2K, Postgres 8.1, why ? which dll ??-> exception error
@ 2006-01-06 05:22 linuxgps <linuxgps@invitel.hu>
0 siblings, 0 replies; 14+ messages in thread
From: linuxgps @ 2006-01-06 05:22 UTC (permalink / raw)
To: pgsql-odbc
The error message I get with the application crash:
'Unhandled exception in Project1.exe (PSQLODBCA.DLL): 0xC0000005:
Access Violation.
^ permalink raw reply [nested|flat] 14+ messages in thread
* Re: VBA 6 crashes with WIN2K, Postgres 8.1, why ? which dll ??
@ 2006-01-06 06:33 Ludek Finstrle <luf@pzkagis.cz>
parent: linuxgps <linuxgps@invitel.hu>
1 sibling, 0 replies; 14+ messages in thread
From: Ludek Finstrle @ 2006-01-06 06:33 UTC (permalink / raw)
To: linuxgps <linuxgps@invitel.hu>; +Cc: pgsql-odbc
> Q 1.: Is this general, or some libraries are wrong on my system ?
There is problem in psqlodbc >= 08.01 (I'm not sure if in 08.00 too).
> 'For updateable recordsets we would typically open a Dynamic recordset.
Updateable recordsets are broken since begin of rewrite to libpq
library. This is the problem.
> 'Forward Only recordsets are much faster but can only scroll forward and
This and static cursors may work correctly.
> rs.Open "SELECT id, data FROM vbtest", cn, adOpenDynamic
adOpenDynamic isn't supported with the newest version.
If you need this behaviour you can try older 07.03 (or maybe 08.00)
version of psqlodbc.
We are at the start point of rewriting the psqlODBC driver. Please
be patient with us.
To all:
Isn't the time to change the documentation? Is here some volunteer which
provide this job for us?
Regards,
Luf
^ permalink raw reply [nested|flat] 14+ messages in thread
* Re: VBA 6 crashes with WIN2K, Postgres 8.1, why ? which dll ??
@ 2006-01-06 08:19 Dave Page <dpage@vale-housing.co.uk>
0 siblings, 1 reply; 14+ messages in thread
From: Dave Page @ 2006-01-06 08:19 UTC (permalink / raw)
To: Ludek Finstrle <luf@pzkagis.cz>; linuxgps <linuxgps@invitel.hu>; +Cc: pgsql-odbc
> -----Original Message-----
> From: pgsql-odbc-owner@postgresql.org
> [mailto:pgsql-odbc-owner@postgresql.org] On Behalf Of Ludek Finstrle
> Sent: 06 January 2006 06:33
> To: linuxgps
> Cc: pgsql-odbc@postgresql.org
> Subject: Re: [ODBC] VBA 6 crashes with WIN2K, Postgres 8.1,
> why ? which dll ??
>
> > Q 1.: Is this general, or some libraries are wrong on my system ?
>
> There is problem in psqlodbc >= 08.01 (I'm not sure if in 08.00 too).
>
> > 'For updateable recordsets we would typically open a
> Dynamic recordset.
>
> Updateable recordsets are broken since begin of rewrite to libpq
> library. This is the problem.
Updateable cursors have *always* been broken. It's an experimental
feature prior to 8.0 which has never had all the kinks worked out.
Regards, Dave
^ permalink raw reply [nested|flat] 14+ messages in thread
* Re: VBA 6 crashes with WIN2K, Postgres 8.1, why ? which dll ??
@ 2006-01-06 08:39 Ludek Finstrle <luf@pzkagis.cz>
parent: Dave Page <dpage@vale-housing.co.uk>
0 siblings, 0 replies; 14+ messages in thread
From: Ludek Finstrle @ 2006-01-06 08:39 UTC (permalink / raw)
To: Dave Page <dpage@vale-housing.co.uk>; +Cc: pgsql-odbc
> > Updateable recordsets are broken since begin of rewrite to libpq
> > library. This is the problem.
>
> Updateable cursors have *always* been broken. It's an experimental
> feature prior to 8.0 which has never had all the kinks worked out.
I'm sorry I mean completely broken (it has never worked in 08.01).
You can have a luck with older releases. It's only partialy broken there.
Why it's in documentation when the support was *always* broken?
I hope the example in documentation is working in older releases.
I hasn't tested it.
Regards,
Luf
^ permalink raw reply [nested|flat] 14+ messages in thread
* Re: VBA 6 crashes with WIN2K, Postgres 8.1, why ? which dll ??
@ 2006-01-06 09:29 Dave Page <dpage@vale-housing.co.uk>
0 siblings, 0 replies; 14+ messages in thread
From: Dave Page @ 2006-01-06 09:29 UTC (permalink / raw)
To: Ludek Finstrle <luf@pzkagis.cz>; +Cc: pgsql-odbc
> -----Original Message-----
> From: Ludek Finstrle [mailto:luf@pzkagis.cz]
> Sent: 06 January 2006 08:39
> To: Dave Page
> Cc: pgsql-odbc@postgresql.org
> Subject: Re: [ODBC] VBA 6 crashes with WIN2K, Postgres 8.1,
> why ? which dll ??
>
> Why it's in documentation when the support was *always* broken?
> I hope the example in documentation is working in older releases.
> I hasn't tested it.
There's an example in the documentation? Where?
Regards, Dave
^ permalink raw reply [nested|flat] 14+ messages in thread
* Re: VBA 6 crashes with WIN2K, Postgres 8.1, why ? whichdll ??
@ 2006-01-06 23:44 Campbell, Greg <greg.campbell@us.michelin.com>
parent: linuxgps <linuxgps@invitel.hu>
1 sibling, 1 reply; 14+ messages in thread
From: Campbell, Greg @ 2006-01-06 23:44 UTC (permalink / raw)
To: linuxgps <linuxgps@invitel.hu>; +Cc: pgsql-odbc
"Interesting" example.
1. Using PostgreSQL is basically a client-server relationship,..so adOpenDynamic (updated cursors) is a
bad choice. I recommend adOpenForwardOnly for fast one-way reading, and adOpenStatic to pull a client side
recordset so that you can move forward and back. In either case declare the recordset Cursor to be client
side (rs.CursorLocation = adUseClient).
This also means no rs.AddNew and no rs.Refresh.
Outside of MS Jet, I think of them as abominations.
I have come to think of the connection between my app and the database as a potentially slow narrow pipe
across a vast distance. Updateable cursors hold open the connection while I cursor up and down, always
tying up more database side resources and network resources. I always send commands, and pull back
recordsets. The only exception that makes sense is the browsing of mammoth datasets (millions of rows).
How practical is your application if you're visually browsing millions of rows.
2. ADODB library version 2.1 is mildly ancient. I'm use to seeing 2.5 on older installations, and lately
2.6,2.7 and maybe a 2.8. At any rate, the latest is always a free download from the MSDN MDAC area
(Microsoft Data Access Components).
3. Again this is a personal preference, but I always use connection.Execute for INSERTS,UPDATE, and
DELETES. Your example used on AddNew and one cnn.Execute.
4. I find a object referencing style and stick with it. rs.Fields("fieldname") and rs!fieldname are both a
little dated. rs("fieldname"), or rs(variable_holding_field_name) or rs(integer_field_ndx) seem to be
cultural standards now.
5. I loathe to admit it, ADO.NET is also a much stronger tool for web/client apps for things like
databinding. With it data grids are bound to disconnected recordsets, which execute discrete INSERTS,
UPDATES, AND DELETE underneath,...again avoiding the updateable cursor.
Oh, and PostgreSQL via ODBC,...
it has never been strong on the updateable cursor/dynamic cursor thing.
linuxgps wrote:
> Hi all,
>
> I'm a beginner to MS Windows.
> I began to to test VBA 6.0(SP6) with Postgresql 8.1 -with odbc- on
> WIN2K(SP4).
> For the test (accessing postgres db thru visual basic) I use the code,
> given by the distro (psqlODBC HOWTO- Visual Basic).
> The first problem I've encounted that the code in the given test snippet
> is not full functioning:
> "rs.Refresh" doesn't implemented ?
> I use in the "Project Preferences" "Microsoft ActiveXData Objects 2.1
> library (msado21.tlb)
>
> I've installed some other MS stuff on the machine, and now the Postgres
> database call makes a memory exception and crashes.
>
> Q 1.: Is this general, or some libraries are wrong on my system ?
> Q 2.: Which MS tools are to control/update the msado-libraries
> Q.3.: Which msado or similars are necessary to connect with visual basic
> to postgres ?
>
> thank you in advance
> testuser vba
>
> -----------------
>
> Sub Main()
> Dim cn as New ADODB.Connection
> Dim rs as New ADODB.Recordset
>
> 'Open the connection
> cn.Open "DSN=<MyDataSourceName>;" & _
> "UID=<MyUsername>;" & _
> "PWD=<MyPassword>;" & _
> "Database=<MyDatabaseName>"
>
> 'For updateable recordsets we would typically open a Dynamic recordset.
> 'Forward Only recordsets are much faster but can only scroll forward
> and 'are read only. Snapshot recordsets are read only, but scroll in
> both 'directions. rs.Open "SELECT id, data FROM vbtest", cn,
> adOpenDynamic
>
> 'Loop though the recordset and print the results
> 'We will also update the accessed column, but this time access it
> through 'the Fields collection. ISO-8601 formatted dates/times are the
> safest IMHO.
> While Not rs.EOF
> Debug.Print rs!id & ": " & rs!data
> rs.Fields("accessed") = Format(Now, "yyyy-MM-dd hh:mm:ss")
> rs.Update
> rs.MoveNext
> Wend
>
> 'Add a new record to the recordset
> rs.AddNew
> rs!id = 76
> rs!data = 'More random data'
> rs!accessed = Format(Now, "yyyy-MM-dd hh:mm:ss")
> rs.Update
>
> 'Insert a new record into the table
> cn.Execute "INSERT INTO vbtest (id, data) VALUES (23, 'Some random
> data');"
>
> 'Refresh the recordset to get that last record...
> rs.Refresh
>
> 'Get the record count
> rs.MoveLast
> rs.MoveFirst
> MsgBox rs.RecordCount & " Records are in the recordset!"
>
> 'Cleanup
> If rs.State <> adStateClosed Then rs.Close
> Set rs = Nothing
> If cn.State <> adStateClosed Then cn.Close
> Set cn = Nothing
> End Sub
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
> choose an index scan if your joining column's datatypes do not
> match
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] 14+ messages in thread
* Re: VBA 6 crashes with WIN2K, Postgres 8.1, why ? whichdll ??
@ 2006-01-07 00:07 linuxgps <linuxgps@invitel.hu>
parent: Campbell, Greg <greg.campbell@us.michelin.com>
0 siblings, 1 reply; 14+ messages in thread
From: linuxgps @ 2006-01-07 00:07 UTC (permalink / raw)
To: Campbell, Greg <greg.campbell@us.michelin.com>; +Cc: pgsql-odbc
Well Greg, you're right.
Just the used code snippet is about 4 years old and was shipped with the
distro.
For beginners I think even a slow code is much better as having nothing.
Have you any tutorial code using Postgres thru VBA with ADO.NET ?
Campbell, Greg wrote:
> "Interesting" example.
> 1. Using PostgreSQL is basically a client-server relationship,..so
> adOpenDynamic (updated cursors) is a bad choice. I recommend
> adOpenForwardOnly for fast one-way reading, and adOpenStatic to pull a
> client side recordset so that you can move forward and back. In either
> case declare the recordset Cursor to be client side (rs.CursorLocation
> = adUseClient).
>
> This also means no rs.AddNew and no rs.Refresh.
> Outside of MS Jet, I think of them as abominations.
>
> I have come to think of the connection between my app and the database
> as a potentially slow narrow pipe across a vast distance. Updateable
> cursors hold open the connection while I cursor up and down, always
> tying up more database side resources and network resources. I always
> send commands, and pull back recordsets. The only exception that makes
> sense is the browsing of mammoth datasets (millions of rows). How
> practical is your application if you're visually browsing millions of
> rows.
>
> 2. ADODB library version 2.1 is mildly ancient. I'm use to seeing 2.5
> on older installations, and lately 2.6,2.7 and maybe a 2.8. At any
> rate, the latest is always a free download from the MSDN MDAC area
> (Microsoft Data Access Components).
>
> 3. Again this is a personal preference, but I always use
> connection.Execute for INSERTS,UPDATE, and DELETES. Your example used
> on AddNew and one cnn.Execute.
>
> 4. I find a object referencing style and stick with it.
> rs.Fields("fieldname") and rs!fieldname are both a little dated.
> rs("fieldname"), or rs(variable_holding_field_name) or
> rs(integer_field_ndx) seem to be cultural standards now.
>
> 5. I loathe to admit it, ADO.NET is also a much stronger tool for
> web/client apps for things like databinding. With it data grids are
> bound to disconnected recordsets, which execute discrete INSERTS,
> UPDATES, AND DELETE underneath,...again avoiding the updateable cursor.
>
> Oh, and PostgreSQL via ODBC,...
> it has never been strong on the updateable cursor/dynamic cursor thing.
>
>
>
> linuxgps wrote:
>
>> Hi all,
>>
>> I'm a beginner to MS Windows.
>> I began to to test VBA 6.0(SP6) with Postgresql 8.1 -with odbc- on
>> WIN2K(SP4).
>> For the test (accessing postgres db thru visual basic) I use the
>> code, given by the distro (psqlODBC HOWTO- Visual Basic).
>> The first problem I've encounted that the code in the given test
>> snippet is not full functioning:
>> "rs.Refresh" doesn't implemented ?
>> I use in the "Project Preferences" "Microsoft ActiveXData Objects 2.1
>> library (msado21.tlb)
>>
>> I've installed some other MS stuff on the machine, and now the
>> Postgres database call makes a memory exception and crashes.
>>
>> Q 1.: Is this general, or some libraries are wrong on my system ?
>> Q 2.: Which MS tools are to control/update the msado-libraries
>> Q.3.: Which msado or similars are necessary to connect with visual
>> basic to postgres ?
>>
>> thank you in advance
>> testuser vba
>>
>> -----------------
>>
>> Sub Main()
>> Dim cn as New ADODB.Connection
>> Dim rs as New ADODB.Recordset
>>
>> 'Open the connection
>> cn.Open "DSN=<MyDataSourceName>;" & _
>> "UID=<MyUsername>;" & _
>> "PWD=<MyPassword>;" & _
>> "Database=<MyDatabaseName>"
>>
>> 'For updateable recordsets we would typically open a Dynamic recordset.
>> 'Forward Only recordsets are much faster but can only scroll forward
>> and 'are read only. Snapshot recordsets are read only, but scroll in
>> both 'directions. rs.Open "SELECT id, data FROM vbtest", cn,
>> adOpenDynamic
>>
>> 'Loop though the recordset and print the results
>> 'We will also update the accessed column, but this time access it
>> through 'the Fields collection. ISO-8601 formatted dates/times are
>> the safest IMHO.
>> While Not rs.EOF
>> Debug.Print rs!id & ": " & rs!data
>> rs.Fields("accessed") = Format(Now, "yyyy-MM-dd hh:mm:ss")
>> rs.Update
>> rs.MoveNext
>> Wend
>>
>> 'Add a new record to the recordset
>> rs.AddNew
>> rs!id = 76
>> rs!data = 'More random data'
>> rs!accessed = Format(Now, "yyyy-MM-dd hh:mm:ss")
>> rs.Update
>>
>> 'Insert a new record into the table
>> cn.Execute "INSERT INTO vbtest (id, data) VALUES (23, 'Some random
>> data');"
>>
>> 'Refresh the recordset to get that last record...
>> rs.Refresh
>>
>> 'Get the record count
>> rs.MoveLast
>> rs.MoveFirst
>> MsgBox rs.RecordCount & " Records are in the recordset!"
>>
>> 'Cleanup
>> If rs.State <> adStateClosed Then rs.Close
>> Set rs = Nothing
>> If cn.State <> adStateClosed Then cn.Close
>> Set cn = Nothing
>> End Sub
>>
>>
>>
>>
>> ---------------------------(end of broadcast)---------------------------
>> TIP 9: In versions below 8.0, the planner will ignore your desire to
>> choose an index scan if your joining column's datatypes do not
>> match
>
>---------------------------(end of broadcast)---------------------------
>TIP 6: explain analyze is your friend
>
>
^ permalink raw reply [nested|flat] 14+ messages in thread
* Re: VBA 6 crashes with WIN2K, Postgres 8.1, why ? whichdll ??
@ 2006-01-07 00:34 Dave Page <dpage@vale-housing.co.uk>
0 siblings, 1 reply; 14+ messages in thread
From: Dave Page @ 2006-01-07 00:34 UTC (permalink / raw)
To: Campbell, Greg <greg.campbell@us.michelin.com>; linuxgps <linuxgps@invitel.hu>; +Cc: pgsql-odbc
> -----Original Message-----
> From: pgsql-odbc-owner@postgresql.org
> [mailto:pgsql-odbc-owner@postgresql.org] On Behalf Of Campbell, Greg
> Sent: 06 January 2006 23:44
> To: linuxgps
> Cc: pgsql-odbc@postgresql.org
> Subject: Re: [ODBC] VBA 6 crashes with WIN2K, Postgres 8.1,
> why ? whichdll ??
>
> 3. Again this is a personal preference, but I always use
> connection.Execute for INSERTS,UPDATE, and
> DELETES. Your example used on AddNew and one cnn.Execute.
>
> 4. I find a object referencing style and stick with it.
> rs.Fields("fieldname") and rs!fieldname are both a
> little dated. rs("fieldname"), or
> rs(variable_holding_field_name) or rs(integer_field_ndx) seem to be
> cultural standards now.
The example is from the psqlODBC VB HOWTO which goes out of it's way to
show the different ways to use ADO with PostgreSQL. Your suggestions are
correct of course, but there is good reason why that code looks as it
does.
> Oh, and PostgreSQL via ODBC,...
> it has never been strong on the updateable cursor/dynamic
> cursor thing.
Don't mix the two up, they are separate things. Dynamic recordsets
(adOpenDynamic) have worked well since at least 1997 when I first wrote
pgAdmin I in VB5, long before Hiroshi added the Updateable Cursors
option to the driver (back when Byron maintained it in fact). They still
do work well with the current versions of the driver (at least, none of
my users of 4 of 5 different VB apps complained when they got upgraded).
The Updateable Cursor option is an experimental implementation of
emulated updateable server-side cursors (which PostgreSQL doesn't
natively support) iirc.
Regards, Dave.
^ permalink raw reply [nested|flat] 14+ messages in thread
* Re: VBA 6 crashes with WIN2K, Postgres 8.1, why ? whichdll??
@ 2006-01-07 00:58 Campbell, Greg <greg.campbell@us.michelin.com>
parent: linuxgps <linuxgps@invitel.hu>
0 siblings, 0 replies; 14+ messages in thread
From: Campbell, Greg @ 2006-01-07 00:58 UTC (permalink / raw)
To: linuxgps <linuxgps@invitel.hu>; +Cc: pgsql-odbc
For ADO.NET I am using Npgsql, which you can get from the affiliated project site -- the Npgsql project.
It is just like using the .NET SQL server, and Oledb libraries from the MSDN. The project site has
documentation with examples on how to use Npgsql. I thinks there stuff in the GBorg and the pgfoundry site.
I works for me.
(except for Parameterized stored procedures using an actual Parameters collection,...maybe it's just me.)
linuxgps wrote:
>
> Well Greg, you're right.
> Just the used code snippet is about 4 years old and was shipped with the
> distro.
> For beginners I think even a slow code is much better as having nothing.
> Have you any tutorial code using Postgres thru VBA with ADO.NET ?
>
> Campbell, Greg wrote:
>
>> "Interesting" example.
>> 1. Using PostgreSQL is basically a client-server relationship,..so
>> adOpenDynamic (updated cursors) is a bad choice. I recommend
>> adOpenForwardOnly for fast one-way reading, and adOpenStatic to pull a
>> client side recordset so that you can move forward and back. In either
>> case declare the recordset Cursor to be client side (rs.CursorLocation
>> = adUseClient).
>>
>> This also means no rs.AddNew and no rs.Refresh.
>> Outside of MS Jet, I think of them as abominations.
>>
>> I have come to think of the connection between my app and the database
>> as a potentially slow narrow pipe across a vast distance. Updateable
>> cursors hold open the connection while I cursor up and down, always
>> tying up more database side resources and network resources. I always
>> send commands, and pull back recordsets. The only exception that makes
>> sense is the browsing of mammoth datasets (millions of rows). How
>> practical is your application if you're visually browsing millions of
>> rows.
>>
>> 2. ADODB library version 2.1 is mildly ancient. I'm use to seeing 2.5
>> on older installations, and lately 2.6,2.7 and maybe a 2.8. At any
>> rate, the latest is always a free download from the MSDN MDAC area
>> (Microsoft Data Access Components).
>>
>> 3. Again this is a personal preference, but I always use
>> connection.Execute for INSERTS,UPDATE, and DELETES. Your example used
>> on AddNew and one cnn.Execute.
>>
>> 4. I find a object referencing style and stick with it.
>> rs.Fields("fieldname") and rs!fieldname are both a little dated.
>> rs("fieldname"), or rs(variable_holding_field_name) or
>> rs(integer_field_ndx) seem to be cultural standards now.
>>
>> 5. I loathe to admit it, ADO.NET is also a much stronger tool for
>> web/client apps for things like databinding. With it data grids are
>> bound to disconnected recordsets, which execute discrete INSERTS,
>> UPDATES, AND DELETE underneath,...again avoiding the updateable cursor.
>>
>> Oh, and PostgreSQL via ODBC,...
>> it has never been strong on the updateable cursor/dynamic cursor thing.
>>
>>
>>
>> linuxgps wrote:
>>
>>> Hi all,
>>>
>>> I'm a beginner to MS Windows.
>>> I began to to test VBA 6.0(SP6) with Postgresql 8.1 -with odbc- on
>>> WIN2K(SP4).
>>> For the test (accessing postgres db thru visual basic) I use the
>>> code, given by the distro (psqlODBC HOWTO- Visual Basic).
>>> The first problem I've encounted that the code in the given test
>>> snippet is not full functioning:
>>> "rs.Refresh" doesn't implemented ?
>>> I use in the "Project Preferences" "Microsoft ActiveXData Objects 2.1
>>> library (msado21.tlb)
>>>
>>> I've installed some other MS stuff on the machine, and now the
>>> Postgres database call makes a memory exception and crashes.
>>>
>>> Q 1.: Is this general, or some libraries are wrong on my system ?
>>> Q 2.: Which MS tools are to control/update the msado-libraries
>>> Q.3.: Which msado or similars are necessary to connect with visual
>>> basic to postgres ?
>>>
>>> thank you in advance
>>> testuser vba
>>>
>>> -----------------
>>>
>>> Sub Main()
>>> Dim cn as New ADODB.Connection
>>> Dim rs as New ADODB.Recordset
>>>
>>> 'Open the connection
>>> cn.Open "DSN=<MyDataSourceName>;" & _
>>> "UID=<MyUsername>;" & _
>>> "PWD=<MyPassword>;" & _
>>> "Database=<MyDatabaseName>"
>>>
>>> 'For updateable recordsets we would typically open a Dynamic recordset.
>>> 'Forward Only recordsets are much faster but can only scroll forward
>>> and 'are read only. Snapshot recordsets are read only, but scroll in
>>> both 'directions. rs.Open "SELECT id, data FROM vbtest", cn,
>>> adOpenDynamic
>>>
>>> 'Loop though the recordset and print the results
>>> 'We will also update the accessed column, but this time access it
>>> through 'the Fields collection. ISO-8601 formatted dates/times are
>>> the safest IMHO.
>>> While Not rs.EOF
>>> Debug.Print rs!id & ": " & rs!data
>>> rs.Fields("accessed") = Format(Now, "yyyy-MM-dd hh:mm:ss")
>>> rs.Update
>>> rs.MoveNext
>>> Wend
>>>
>>> 'Add a new record to the recordset
>>> rs.AddNew
>>> rs!id = 76
>>> rs!data = 'More random data'
>>> rs!accessed = Format(Now, "yyyy-MM-dd hh:mm:ss")
>>> rs.Update
>>>
>>> 'Insert a new record into the table
>>> cn.Execute "INSERT INTO vbtest (id, data) VALUES (23, 'Some random
>>> data');"
>>>
>>> 'Refresh the recordset to get that last record...
>>> rs.Refresh
>>>
>>> 'Get the record count
>>> rs.MoveLast
>>> rs.MoveFirst
>>> MsgBox rs.RecordCount & " Records are in the recordset!"
>>>
>>> 'Cleanup
>>> If rs.State <> adStateClosed Then rs.Close
>>> Set rs = Nothing
>>> If cn.State <> adStateClosed Then cn.Close
>>> Set cn = Nothing
>>> End Sub
>>>
>>>
>>>
>>>
>>> ---------------------------(end of broadcast)---------------------------
>>> TIP 9: In versions below 8.0, the planner will ignore your desire to
>>> choose an index scan if your joining column's datatypes do not
>>> match
>>
>>
>> ---------------------------(end of broadcast)---------------------------
>> TIP 6: explain analyze is your friend
>>
>>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
> choose an index scan if your joining column's datatypes do not
> match
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] 14+ messages in thread
* Re: VBA 6 crashes with WIN2K, Postgres 8.1, why ? whichdll??
@ 2006-01-07 01:25 Campbell, Greg <greg.campbell@us.michelin.com>
parent: Dave Page <dpage@vale-housing.co.uk>
0 siblings, 1 reply; 14+ messages in thread
From: Campbell, Greg @ 2006-01-07 01:25 UTC (permalink / raw)
To: Dave Page <dpage@vale-housing.co.uk>; +Cc: linuxgps <linuxgps@invitel.hu>; pgsql-odbc
You can help me understand the utility of the adOpenDynamic. Both adOpenStatic, and adOpenDynamic allow
moving through the recordset in multiple directions. With adOpenDynamic, other users changes are visible
in your recordset, as opposed to the static which is more of a snapshot.
Then there is the CursorLocation parameter (client-side or server-side).
How does it work to use adOpenDynamic (for viability of updates from others), if the cursor is not
server-side? If server-side cursor is the only way of getting the added value of adOpenDynamic, doesn't
that mean an updateable cursor?
Here's another angle of attack to help my understanding.
adOpenDynamic shows changes made by others.
Updateable cursors allow me to make changes along an open cursor back to the database.
Are you saying the simple adOpenDynamic configuration is allowing changes to to get to me, along a
communication channel without my ability to make changes back along that channel?
Dave Page wrote:
>
>
>
>>-----Original Message-----
>>From: pgsql-odbc-owner@postgresql.org
>>[mailto:pgsql-odbc-owner@postgresql.org] On Behalf Of Campbell, Greg
>>Sent: 06 January 2006 23:44
>>To: linuxgps
>>Cc: pgsql-odbc@postgresql.org
>>Subject: Re: [ODBC] VBA 6 crashes with WIN2K, Postgres 8.1,
>>why ? whichdll ??
>>
>>3. Again this is a personal preference, but I always use
>>connection.Execute for INSERTS,UPDATE, and
>>DELETES. Your example used on AddNew and one cnn.Execute.
>>
>>4. I find a object referencing style and stick with it.
>>rs.Fields("fieldname") and rs!fieldname are both a
>>little dated. rs("fieldname"), or
>>rs(variable_holding_field_name) or rs(integer_field_ndx) seem to be
>>cultural standards now.
>
>
> The example is from the psqlODBC VB HOWTO which goes out of it's way to
> show the different ways to use ADO with PostgreSQL. Your suggestions are
> correct of course, but there is good reason why that code looks as it
> does.
>
>
>>Oh, and PostgreSQL via ODBC,...
>>it has never been strong on the updateable cursor/dynamic
>>cursor thing.
>
>
> Don't mix the two up, they are separate things. Dynamic recordsets
> (adOpenDynamic) have worked well since at least 1997 when I first wrote
> pgAdmin I in VB5, long before Hiroshi added the Updateable Cursors
> option to the driver (back when Byron maintained it in fact). They still
> do work well with the current versions of the driver (at least, none of
> my users of 4 of 5 different VB apps complained when they got upgraded).
> The Updateable Cursor option is an experimental implementation of
> emulated updateable server-side cursors (which PostgreSQL doesn't
> natively support) iirc.
>
> Regards, Dave.
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] 14+ messages in thread
* Re: VBA 6 crashes with WIN2K, Postgres 8.1, why ?
@ 2006-01-08 11:01 Dave Page <dpage@vale-housing.co.uk>
parent: Campbell, Greg <greg.campbell@us.michelin.com>
0 siblings, 1 reply; 14+ messages in thread
From: Dave Page @ 2006-01-08 11:01 UTC (permalink / raw)
To: Campbell, Greg <greg.campbell@us.michelin.com>; +Cc: linuxgps <linuxgps@invitel.hu>; pgsql-odbc
On 7/1/06 01:25, "Campbell, Greg" <greg.campbell@us.michelin.com> wrote:
> You can help me understand the utility of the adOpenDynamic. Both
> adOpenStatic, and adOpenDynamic allow
> moving through the recordset in multiple directions. With adOpenDynamic, other
> users changes are visible
> in your recordset, as opposed to the static which is more of a snapshot.
>
> Then there is the CursorLocation parameter (client-side or server-side).
>
> How does it work to use adOpenDynamic (for viability of updates from others),
> if the cursor is not
> server-side? If server-side cursor is the only way of getting the added value
> of adOpenDynamic, doesn't
> that mean an updateable cursor?
>
Bad post-midnight phrasing on my part I'm afraid :-(. AdOpenDynamic works in
the sense that it will not crash. It will be essentially the same as
adOpenStatic though as it won't see other user's changes. AdOpenDynamic
might be made to do so with real updateable server side cursors created WITH
HOLD I guess.
Regards, Dave
^ permalink raw reply [nested|flat] 14+ messages in thread
* Re: VBA 6 crashes with WIN2K, Postgres 8.1, why ?
@ 2006-01-08 16:32 Campbell, Greg <greg.campbell@us.michelin.com>
parent: Dave Page <dpage@vale-housing.co.uk>
0 siblings, 0 replies; 14+ messages in thread
From: Campbell, Greg @ 2006-01-08 16:32 UTC (permalink / raw)
To: Dave Page <dpage@vale-housing.co.uk>; +Cc: pgsql-odbc
Thanks Dave. That completely agrees with my experience. In effect adOpenDynamic currently acts the same as
adOpenStatic. My anal retentitive side much prefers seeing adOpenStatic, because the results agree with my
expectations when I see that.
And on the post midnight thing, I lost track of the time difference and at the time remember thinking,
"Why is this guy doing postgres odbc postings in the middle of the season premier of Galactica?".
Dave Page wrote:
>
>
> On 7/1/06 01:25, "Campbell, Greg" <greg.campbell@us.michelin.com> wrote:
>
>
>>You can help me understand the utility of the adOpenDynamic. Both
>>adOpenStatic, and adOpenDynamic allow
>>moving through the recordset in multiple directions. With adOpenDynamic, other
>>users changes are visible
>>in your recordset, as opposed to the static which is more of a snapshot.
>>
>>Then there is the CursorLocation parameter (client-side or server-side).
>>
>>How does it work to use adOpenDynamic (for viability of updates from others),
>>if the cursor is not
>>server-side? If server-side cursor is the only way of getting the added value
>>of adOpenDynamic, doesn't
>>that mean an updateable cursor?
>>
>
>
> Bad post-midnight phrasing on my part I'm afraid :-(. AdOpenDynamic works in
> the sense that it will not crash. It will be essentially the same as
> adOpenStatic though as it won't see other user's changes. AdOpenDynamic
> might be made to do so with real updateable server side cursors created WITH
> HOLD I guess.
>
> Regards, Dave
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faq
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] 14+ messages in thread
* Re: VBA 6 crashes with WIN2K, Postgres 8.1, why ?
@ 2006-01-08 17:24 Dave Page <dpage@vale-housing.co.uk>
0 siblings, 0 replies; 14+ messages in thread
From: Dave Page @ 2006-01-08 17:24 UTC (permalink / raw)
To: Campbell, Greg <greg.campbell@us.michelin.com>; +Cc: pgsql-odbc
-----Original Message-----
From: Campbell, Greg [mailto:greg.campbell@us.michelin.com]
Sent: Sun 1/8/2006 4:32 PM
To: Dave Page
Cc: pgsql-odbc@postgresql.org
Subject: Re: [ODBC] VBA 6 crashes with WIN2K, Postgres 8.1, why ?
> And on the post midnight thing, I lost track of the time
> difference and at the time remember thinking,
> "Why is this guy doing postgres odbc postings in the middle
> of the season premier of Galactica?".
Hehe - the best I had to watch were reruns of season 1 of The Shield. Galactica starts tomorrow iirc.
Regards, Dave
^ permalink raw reply [nested|flat] 14+ messages in thread
end of thread, other threads:[~2006-01-08 17:24 UTC | newest]
Thread overview: 14+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-01-06 04:12 VBA 6 crashes with WIN2K, Postgres 8.1, why ? which dll ?? linuxgps <linuxgps@invitel.hu>
2006-01-06 06:33 ` Ludek Finstrle <luf@pzkagis.cz>
2006-01-06 23:44 ` Re: VBA 6 crashes with WIN2K, Postgres 8.1, why ? whichdll ?? Campbell, Greg <greg.campbell@us.michelin.com>
2006-01-07 00:07 ` Re: VBA 6 crashes with WIN2K, Postgres 8.1, why ? whichdll ?? linuxgps <linuxgps@invitel.hu>
2006-01-07 00:58 ` Re: VBA 6 crashes with WIN2K, Postgres 8.1, why ? whichdll?? Campbell, Greg <greg.campbell@us.michelin.com>
2006-01-06 05:22 VBA 6 crashes with WIN2K, Postgres 8.1, why ? which dll ??-> exception error linuxgps <linuxgps@invitel.hu>
2006-01-06 08:19 Re: VBA 6 crashes with WIN2K, Postgres 8.1, why ? which dll ?? Dave Page <dpage@vale-housing.co.uk>
2006-01-06 08:39 ` Ludek Finstrle <luf@pzkagis.cz>
2006-01-06 09:29 Re: VBA 6 crashes with WIN2K, Postgres 8.1, why ? which dll ?? Dave Page <dpage@vale-housing.co.uk>
2006-01-07 00:34 Re: VBA 6 crashes with WIN2K, Postgres 8.1, why ? whichdll ?? Dave Page <dpage@vale-housing.co.uk>
2006-01-07 01:25 ` Re: VBA 6 crashes with WIN2K, Postgres 8.1, why ? whichdll?? Campbell, Greg <greg.campbell@us.michelin.com>
2006-01-08 11:01 ` Re: VBA 6 crashes with WIN2K, Postgres 8.1, why ? Dave Page <dpage@vale-housing.co.uk>
2006-01-08 16:32 ` Re: VBA 6 crashes with WIN2K, Postgres 8.1, why ? Campbell, Greg <greg.campbell@us.michelin.com>
2006-01-08 17:24 Re: VBA 6 crashes with WIN2K, Postgres 8.1, why ? Dave Page <dpage@vale-housing.co.uk>
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