Error if SQL Server query returns hierarchyid field, DataReader.GetFieldType(14) returns null

60 views
Skip to first unread message

Allen Johnson

unread,
Jul 13, 2023, 2:03:24 PM7/13/23
to dbfit
I have been using DBFit 3.2 for many years, I currently have it running on a Windows 10 test machine pointing to a MS SQL Server database on another server.

I just did a new install of DBFit 4.0 on a Windows 11 machine.  
Now any Query, even an Inspect Query, where the results contain a hierarchyid field type throws an exception (the number in the error varies depending on where that field is in the result set):

System.InvalidOperationException: DataReader.GetFieldType(14) returned null. at System.Data.ProviderBase.SchemaMapping.SetupSchemaWithoutKeyInfo(MissingMappingAction mappingAction, MissingSchemaAction schemaAction, Boolean gettingData, DataColumn parentChapterColumn, Object chapterValue) at System.Data.ProviderBase.SchemaMapping..ctor(DataAdapter adapter, DataSet dataset, DataTable datatable, DataReaderContainer dataReader, Boolean keyInfo, SchemaType schemaType, String sourceTableName, Boolean gettingData, DataColumn parentChapterColumn, Object parentChapterValue) at System.Data.Common.DataAdapter.FillMappingInternal(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 schemaCount, DataColumn parentChapterColumn, Object parentChapterValue)

The database is the same, I'm using the same connection string:
!|Connect|Server=myserver; Database=mytestdb; Trusted_Connection=yes;Type System Version=SQL Server 2012;|
I tried copying my old DBFit 3.2 installation to the new machine and I get the same error.
So I feel like I'm missing some package or dependency on this new machine, possibly Windows 11 specific, but can't figure out what else I need to install or set up.
I found other references to this error, but they all seem related to C# development environments: https://stackoverflow.com/questions/6569624/datareader-getfieldtype-returned-null

Any ideas?

Thanks.
Allen
Reply all
Reply to author
Forward
0 new messages