Home > Archive > Visual FoxPro SQL Queries > February 2006 > ADO from VFP









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author ADO from VFP
Tom Edelbrok

2006-02-08, 3:24 am

I'm a novice VFP 8 programmer and want to access a Postgresql database via a
DSN. Here's my code:


poConnection = CREATEOBJECT("adodb.connection")
WITH poConnection
.ConnectionString = "provider=VFPOLEDB.1;DSN=postgresql"
.OPEN
ENDWITH


However, when I run it the program stops at the ".open" with the error
message:

OLE Idispatch exception code 0 from Microsoft OLE DB Provider for Visual
Foxpro;
Feature is not available ...


Can anyone tell me what I'm missing? Do I have to somehow add a reference to
Microsoft ADO to the project?

Thanks in advance,

Tom


Fred Taylor

2006-02-08, 3:24 am

You wouldn't use the VFPOLEDB provider to access PostgresSQL data, you
would use VFPOLEDB to access VFP data. You need a PostgresSQL provider or
ODBC driver.

--
Fred
Microsoft Visual FoxPro MVP


"Tom Edelbrok" <anonymous@anonymous.com> wrote in message
news:R5hGf.583635$ki.385982@pd7tw2no...
> I'm a novice VFP 8 programmer and want to access a Postgresql database via
> a
> DSN. Here's my code:
>
>
> poConnection = CREATEOBJECT("adodb.connection")
> WITH poConnection
> .ConnectionString = "provider=VFPOLEDB.1;DSN=postgresql"
> .OPEN
> ENDWITH
>
>
> However, when I run it the program stops at the ".open" with the error
> message:
>
> OLE Idispatch exception code 0 from Microsoft OLE DB Provider for Visual
> Foxpro;
> Feature is not available ...
>
>
> Can anyone tell me what I'm missing? Do I have to somehow add a reference
> to
> Microsoft ADO to the project?
>
> Thanks in advance,
>
> Tom
>
>



Craig Berntson

2006-02-08, 11:24 am

In addition to what Fred told you, if you use a DSN as part of your ADO
connection string, you'll also use ODBC...which will be slow. See
http://msdn.microsoft.com/library/d....asp?frame=true
for more info.

--
Craig Berntson
MCSD, Visual FoxPro MVP
www.craigberntson.com
Salt Lake City Fox User Group
www.slcfox.org
www.foxcentral.net


"Tom Edelbrok" <anonymous@anonymous.com> wrote in message
news:R5hGf.583635$ki.385982@pd7tw2no...
> I'm a novice VFP 8 programmer and want to access a Postgresql database via
> a
> DSN. Here's my code:
>
>
> poConnection = CREATEOBJECT("adodb.connection")
> WITH poConnection
> .ConnectionString = "provider=VFPOLEDB.1;DSN=postgresql"
> .OPEN
> ENDWITH
>
>
> However, when I run it the program stops at the ".open" with the error
> message:
>
> OLE Idispatch exception code 0 from Microsoft OLE DB Provider for Visual
> Foxpro;
> Feature is not available ...
>
>
> Can anyone tell me what I'm missing? Do I have to somehow add a reference
> to
> Microsoft ADO to the project?
>
> Thanks in advance,
>
> Tom
>
>



lamlinks

2006-02-08, 8:26 pm

Fred,

I recently upgraded from VFP6 to 9. However VFP9 does not share remote
connections as VFP6 did. Can you reproduce this problem?

Alan

A database accessing SQL via ODBC with sharable remote view 'A' will
share
the connection (IE have the same connection handle) only when view 'A'
is
opened multiple times.
View 'B' in the same database, with the same connection name that is
also
sharable will create a new connection handle when used. A second use of
'B'
will share the connection originally used by 'B". But 'A' and 'B do not
share
a connection.
This is easily demonstrated
? CURSORGETPROP('Share
')
? CURSORGETPROP('Conne
ctHandle')

Fred Taylor

2006-02-09, 8:28 pm

Sorry, I don't use shared connections, so I can't be of much help.

--
Fred
Microsoft Visual FoxPro MVP


"lamlinks" <alan.kliner@gmail.com> wrote in message
news:1139431541.290258.67520@z14g2000cwz.googlegroups.com...
> Fred,
>
> I recently upgraded from VFP6 to 9. However VFP9 does not share remote
> connections as VFP6 did. Can you reproduce this problem?
>
> Alan
>
> A database accessing SQL via ODBC with sharable remote view 'A' will
> share
> the connection (IE have the same connection handle) only when view 'A'
> is
> opened multiple times.
> View 'B' in the same database, with the same connection name that is
> also
> sharable will create a new connection handle when used. A second use of
> 'B'
> will share the connection originally used by 'B". But 'A' and 'B do not
> share
> a connection.
> This is easily demonstrated
> ? CURSORGETPROP('Share
')
> ? CURSORGETPROP('Conne
ctHandle')
>



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com