[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.odbcnet

ODBC Connectivity Issues with .NET

M.Treadway@AustinLaneTech.com

6/16/2004 4:02:00 PM

Hey, I'm moving a VB application to C# and the VB program
accessed a datasource through ADO using the OLE DB
provider for ODBC drivers. I'm able to access the
datasource through the .NET IDE because it is also using
OLE DB, but .NET forces me to use the ODBC driver directly
with the OdbcConnection object and it just won't work.

I've tried every possible connection string I can think of
from reading other posts and each one them produces the
same exception when opening the connection:

"[Microsoft][ODBC Driver Manager] The driver doesn't
support the version of ODBC behavior that the application
requested (see SQLSetEnvAttr)."

I used the ODBC Test application to connect and it reports
the same message but follows it with a successfully
connected statement.

The ODBC Test program doesn't report the error when I use
ODBC 2.0

Is there anything I can do about this?
5 Answers

Paul Clement

6/16/2004 7:57:00 PM

0

On Wed, 16 Jun 2004 07:02:09 -0700, <M.Treadway@AustinLaneTech.com> wrote:

¤ Hey, I'm moving a VB application to C# and the VB program
¤ accessed a datasource through ADO using the OLE DB
¤ provider for ODBC drivers. I'm able to access the
¤ datasource through the .NET IDE because it is also using
¤ OLE DB, but .NET forces me to use the ODBC driver directly
¤ with the OdbcConnection object and it just won't work.
¤
¤ I've tried every possible connection string I can think of
¤ from reading other posts and each one them produces the
¤ same exception when opening the connection:
¤
¤ "[Microsoft][ODBC Driver Manager] The driver doesn't
¤ support the version of ODBC behavior that the application
¤ requested (see SQLSetEnvAttr)."
¤
¤ I used the ODBC Test application to connect and it reports
¤ the same message but follows it with a successfully
¤ connected statement.
¤
¤ The ODBC Test program doesn't report the error when I use
¤ ODBC 2.0
¤
¤ Is there anything I can do about this?

What is the database you are working with and are you using a DSN?


Paul ~~~ pclement@ameritech.net
Microsoft MVP (Visual Basic)

M.Treadway@AustinLaneTech.com

6/16/2004 9:56:00 PM

0


>-----Original Message-----
>On Wed, 16 Jun 2004 07:02:09 -0700,=20
<M.Treadway@AustinLaneTech.com> wrote:
>
>=A4 Hey, I'm moving a VB application to C# and the VB=20
program=20
>=A4 accessed a datasource through ADO using the OLE DB=20
>=A4 provider for ODBC drivers. I'm able to access the=20
>=A4 datasource through the .NET IDE because it is also=20
using=20
>=A4 OLE DB, but .NET forces me to use the ODBC driver=20
directly=20
>=A4 with the OdbcConnection object and it just won't work.
>=A4=20
>=A4 I've tried every possible connection string I can think=20
of=20
>=A4 from reading other posts and each one them produces the=20
>=A4 same exception when opening the connection:
>=A4=20
>=A4 "[Microsoft][ODBC Driver Manager] The driver doesn't=20
>=A4 support the version of ODBC behavior that the=20
application=20
>=A4 requested (see SQLSetEnvAttr)."
>=A4=20
>=A4 I used the ODBC Test application to connect and it=20
reports=20
>=A4 the same message but follows it with a successfully=20
>=A4 connected statement.
>=A4=20
>=A4 The ODBC Test program doesn't report the error when I=20
use=20
>=A4 ODBC 2.0
>=A4=20
>=A4 Is there anything I can do about this?
>
>What is the database you are working with and are you=20
using a DSN?
>
>
>Paul ~~~ pclement@ameritech.net
>Microsoft MVP (Visual Basic)
>.
>

Well, I believe the database is some form of a pervasive=20
database, the vendor has provided a driver which has=20
worked just fine the past few years. =20

I was originally using a System DSN in VB6 but I've tried=20
both a DSN and DSNless connection with .NET, I've also=20
verified that the DSN is a System DSN and that there isn't=20
a User DSN with the same name.

Paul Clement

6/17/2004 7:27:00 PM

0

On Wed, 16 Jun 2004 12:56:45 -0700, "Mike" <M.Treadway@AustinLaneTech.com> wrote:

¤
¤ >-----Original Message-----
¤ >On Wed, 16 Jun 2004 07:02:09 -0700,
¤ <M.Treadway@AustinLaneTech.com> wrote:
¤ >
¤ >¤ Hey, I'm moving a VB application to C# and the VB
¤ program
¤ >¤ accessed a datasource through ADO using the OLE DB
¤ >¤ provider for ODBC drivers. I'm able to access the
¤ >¤ datasource through the .NET IDE because it is also
¤ using
¤ >¤ OLE DB, but .NET forces me to use the ODBC driver
¤ directly
¤ >¤ with the OdbcConnection object and it just won't work.
¤ >¤
¤ >¤ I've tried every possible connection string I can think
¤ of
¤ >¤ from reading other posts and each one them produces the
¤ >¤ same exception when opening the connection:
¤ >¤
¤ >¤ "[Microsoft][ODBC Driver Manager] The driver doesn't
¤ >¤ support the version of ODBC behavior that the
¤ application
¤ >¤ requested (see SQLSetEnvAttr)."
¤ >¤
¤ >¤ I used the ODBC Test application to connect and it
¤ reports
¤ >¤ the same message but follows it with a successfully
¤ >¤ connected statement.
¤ >¤
¤ >¤ The ODBC Test program doesn't report the error when I
¤ use
¤ >¤ ODBC 2.0
¤ >¤
¤ >¤ Is there anything I can do about this?
¤ >
¤ >What is the database you are working with and are you
¤ using a DSN?
¤ >
¤ >
¤ >Paul ~~~ pclement@ameritech.net
¤ >Microsoft MVP (Visual Basic)
¤ >.
¤ >
¤
¤ Well, I believe the database is some form of a pervasive
¤ database, the vendor has provided a driver which has
¤ worked just fine the past few years.
¤
¤ I was originally using a System DSN in VB6 but I've tried
¤ both a DSN and DSNless connection with .NET, I've also
¤ verified that the DSN is a System DSN and that there isn't
¤ a User DSN with the same name.


So this an ODBC driver? What is connection string that works with your VB application?


Paul ~~~ pclement@ameritech.net
Microsoft MVP (Visual Basic)

Paul Clement

6/21/2004 7:41:00 PM

0

On Fri, 18 Jun 2004 09:55:48 -0700, <anonymous@discussions.microsoft.com> wrote:

¤ Here is what worked in VB6
¤
¤ Provider=MSDASQL.1;Extended Properties="DSN=My
¤ DSN;DBQ=T:\Accounting\Construction Sample
¤ Data;CODEPAGE=1252;DictionaryMode=0;StandardMode=1;MaxColSu
¤ pport=1536;"
¤
¤ Where T:\ is a network drive if that makes any difference.
¤ What do you think?

Not sure. Have you tried a UNC path name?


Paul ~~~ pclement@ameritech.net
Microsoft MVP (Visual Basic)

M.Treadway@AustinLaneTech.com

6/23/2004 5:20:00 PM

0


>-----Original Message-----
>On Fri, 18 Jun 2004 09:55:48 -0700,=20
<anonymous@discussions.microsoft.com> wrote:
>
>=A4 Here is what worked in VB6
>=A4=20
>=A4 Provider=3DMSDASQL.1;Extended Properties=3D"DSN=3DMy=20
>=A4 DSN;DBQ=3DT:\Accounting\Construction Sample=20
>=A4=20
Data;CODEPAGE=3D1252;DictionaryMode=3D0;StandardMode=3D1;MaxColSu
>=A4 pport=3D1536;"
>=A4=20
>=A4 Where T:\ is a network drive if that makes any=20
difference.=20
>=A4 What do you think?
>
>Not sure. Have you tried a UNC path name?
>
>
>Paul ~~~ pclement@ameritech.net
>Microsoft MVP (Visual Basic)
>.
>

I did try a UNC path with the same results. Get this, it=20
has something to do with permissions. I created a small=20
C++ app in vs6 that connected to a datasource and executed=20
the SQL commands passed to it via the command line. The=20
SQL commands I used were statements telling the MS SQL=20
server to link to the ODBC datasource and query a table=20
which works great in the Query Analyzer.=20

I got the same error message using the C++ app utilizing=20
ADO and OLE DB. It turns out that if I connect to the MS=20
SQL database using Windows authentication, AND I set the=20
ODBC driver to a local path...it works. However, if I=20
connect to the database as 'sa', it does not work.

I'm think the real issue has to do with SQL Server not=20
being able to accsss network resources from a database=20
login such as 'sa'.

What are you thoughts?