[lnkForumImage]
TotalShareware - Download Free Software

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


 

Fred Jones

2/28/2002 10:02:00 PM

I've been trying to get the ODBC Data Provider to work with my ODBC Driver,
but I have run into a problem that is not consistent.

Using the ODBC Data Provider I create a connection to the DSN and open it. I
then create a new DataSet and ODBCDataAdapter. The query I issue is a simple
"select * from table". I use the ODBCDataAdapter to fill my DataSet with the
query results. And it works just fine.

I then Try the Exact same thing, but I point my DSN to a different Database,
and when I try to fill the DataSet I get the following Exception.

Microsoft.Data.Odbc.OdbcException: NO_DATA - no error information available.
at System.Data.Common.DbDataAdapter.FillErrorHandler(Exception e,
DataTable dataTable, Object[] dataValues)
at System.Data.Common.DbDataAdapter.FillLoadDataRowChuck(SchemaMapping
mapping, Int32 maxRecords)
at System.Data.Common.DbDataAdapter.FillFromReader(Object data, String
srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords,
DataColumn parentChapterColumn, object parentChapterValue)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable,
IDataReader dataReader, Int32 startRecord, Int32 maxRecords)
at System.Data.Common.DbDataAdapter.Fill(Object data, Int32 startRecord,
Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior
behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataset, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataset, Int32
startRecord, Int32 maxRecords, String srcTable)

Also I have found that sometime it will read a few records into the DataSet
Table before it throws the exception.

Has anyone got any ideas ?

Thanks,
Fred Jones


1 Answer

JT

2/28/2002 11:20:00 PM

0

Fred,
There is a conflict with the ODBC driver manager handling ANSI data.
MyODBC is an ANSI driver. The problem manifests itself when you attempt to
read data that is empty (""). Note this is different than NULL. The
exception you are seeing is the result.
The work around is to ensure none of you columns contain empty strings.
You could also catch and bury the exception, however this is not a
recommended/good idea. The latest faq at mysql has more info.

JT

Here is an post from M$:
<quote>
Hi Johannes,

A number of folks have posted this problem when using the MYSQL ODBC
driver. We have been investigating this and the problem appears to be with
conversions which are done by the ODBC driver manager when an ODBC 3.0
application is calling SQLGetData on an ODBC driver which doesn't support
the UNICODE ODBC APIs. In this case, the ODBC Driver manager is returning
SQL_NO_DATA rather than SQL_SUCCESS as it shoud with a zero-length string.
If we confirm that this is a problem with the driver manager, we will push
to get it fixed in the next MDAC Service Pack (2.7 SP1).

In the mean-time, not using empty string data (use null values perhaps or
pad with spaces) would be one way to resolve the problem. Anything but
having zero-length data would work.

For those ODBC drivers which are ODBC 3.0 drivers and support the Unicode
APIs, the problem will not occur.

Dan Kirby
Microsoft Corporation

</quote>