.NETGURU
Closing an OdbcDataReader causes an exception
Messages   Related Types
This message was discovered on microsoft.public.dotnet.framework.odbcnet.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
Post a new message to this list...

John R. Lewis
I am writing a little utility to transfer data from a unix based
database into sql server. I have an ODBC driver installed, and it
seems to work just fine. But if I call the Close() method on my
OdbcDataReader object, I get the following exception.

System.Data.Odbc.OdbcException: ERROR [IM001] [Microsof
t][ODBC Driver Manager] Driver does not support this function
at System.Data.Odbc.OdbcConnection.HandleError(HandleRef hrHandle,
SQL_HANDLE
hType, RETCODE retcode)
at System.Data.Odbc.OdbcDataReader.NextResult()
at System.Data.Odbc.OdbcDataReader.Dispose(Boolean disposing)
at System.Data.Odbc.OdbcDataReader.Close()
at BasisToSqlDataTransfer.DataTransfer.TransferData() in
c:\documents and set
tings\lewisjr3\my documents\central\source\basistosqldatatransfer\datatransfer.c
s:line 57

It appears that the driver does not support the NextResult method. I
tried calling ExecuteReader method using the
CommandBehavior.SingleResult argument, but still get the same
exception.

How do I close my reader without getting this exception? Opening and
closing the connection takes a long time with this driver. I'd rather
just leave the connection open and execute each reader against it.
Reply to this message...
 
    
Alexander Pinsker
Don't you forgot to call Dispose() on your Command before closing
OdbcDataReader ?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Reply to this message...
 
    
Kevin Yu [MSFT] (VIP)
Hi John,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that when you're trying to close an open
DataReader, an exception is thrown which says "Driver does not support this
function". If there is any misunderstanding, please feel free to let me
know.

Based on my research, this is a known issue. We have seen odd problems with
ADO.Net and some of the third party odbc drivers that are only compliant to
ODBC 2.0, not to ODBC 3.0. These problems usually show up when
you do something that tries to read metadata. This is because the ODBC
driver is too old and lack of some required APIs that ADO.Net need to call.

We have a KB article talking about this issue. Here is the link.

http://support.microsoft.com/default.aspx?scid=kb;en-us;321895

Unfortunately, currently we have no workaround on this. You can go to the
provider to ask them to come out with a new driver that understands the
newer ODBC calls ( or, better still, an OLEDB Provider), or I guess that
you will have to stick to ADO.

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Reply to this message...
 
 
System.Data.CommandBehavior
System.Data.Odbc.OdbcConnection
System.Data.Odbc.OdbcDataReader
System.Data.Odbc.OdbcException
System.Runtime.InteropServices.HandleRef




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