Search:
Namespaces
Discussions
.NET v1.1
Feedback
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
Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us
-
Terms of Use
-
Privacy Policy
-
www.dotnet247.com