开发者

Exception thrown when retrieving ODBC schema using .Net System.Data.ODBC

开发者 https://www.devze.com 2023-01-18 20:24 出处:网络
Our customer is using a driver by iWay Software to provide ODBC access to sequential files on a mainframe system. They are able to access the data successfully from Excel using the ODBC source but whe

Our customer is using a driver by iWay Software to provide ODBC access to sequential files on a mainframe system. They are able to access the data successfully from Excel using the ODBC source but when we try to access the schema information using GetSchemaTable() on a successfully opened DbDataReader the following exception is thrown:

System.ArgumentException: Unknown SQL type - 0. at System.Data.Odbc.TypeMap.FromSqlType(SQL_TYPE sqltype) at System.Data.Odbc.OdbcDataReader.BuildMetaDataInfo() at System.Data.Odbc.OdbcDataReader.GetSchemaTable() at System.Data.Odbc.OdbcMetaDataFactory.DataTableFromDataReaderDataTypes(DataTable dataTypesTable, OdbcDataReader dataReader, OdbcConnection connection) at System.Data.Odbc.OdbcMetaDataFactory.GetDataTypesCollection(String[] restrictions, OdbcConnection connection) at System.Data.Odbc.OdbcMetaDataFactory.PrepareCollection(String collectionName, String[] restrictions, DbConnectionconnection) at System.Data.ProviderBase.DbMetaDataFactory.GetSchema(DbConnection connection, String collectionName, String[] restrictions) at System.Data.ProviderBase.DbConnectionInte开发者_JS百科rnal.GetSchema(DbConnectionFactory factory, DbConnectionPoolGroup poolGroup, DbConnection outerConnection, String collectionName, String[] restrictions) at System.Data.Odbc.OdbcConnection.GetSchema(String collectionName, String[] restrictionValues) at System.Data.Odbc.OdbcConnection.GetSchema(String collectionName) at MyApplication.ReadAdo.GetRowDefinition()

From the looks of things a System.ArgumentException is being thrown in System.Data.Odbc.TypeMap.FromSqlType() due to an unknown SQL type of 0.

Is there any way that we can ignore this error as we don't really require the data types for the columns, just the list of columns names? Alternatively, is there any other way that we can access this schema information?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号