.NETGURU
ODBC Connectivity Issues with .NET
Messages   Related Types
This message was discovered on microsoft.public.dotnet.framework.odbcnet.

Post a new message to this list...

m.treadway@austinlanetech.com
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?
Reply to this message...
 
    
Paul Clement
On Wed, 16 Jun 2004 07:02:09 -0700, <Click here to reveal e-mail address> 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 ~~~ Click here to reveal e-mail address
Microsoft MVP (Visual Basic)
Reply to this message...
 
    
Mike
[Original message clipped]

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.
Reply to this message...
 
    
Paul Clement
On Wed, 16 Jun 2004 12:56:45 -0700, "Mike" <Click here to reveal e-mail address> wrote:

¤
¤ >-----Original Message-----
¤ >On Wed, 16 Jun 2004 07:02:09 -0700,
¤ <Click here to reveal e-mail address> 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 ~~~ Click here to reveal e-mail address
¤ >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 ~~~ Click here to reveal e-mail address
Microsoft MVP (Visual Basic)
Reply to this message...
 
    
anonymous@discussions.microsoft.com
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?
Reply to this message...
 
    
Paul Clement
On Fri, 18 Jun 2004 09:55:48 -0700, <Click here to reveal e-mail address> 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 ~~~ Click here to reveal e-mail address
Microsoft MVP (Visual Basic)
Reply to this message...
 
    
Mike
[Original message clipped]

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

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

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

What are you thoughts?
Reply to this message...
 
 
System.Data.Odbc.OdbcConnection




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification