Using .NET Core System.Data.OleDb with the SQL Server Compact provider throws this error, when reading ntext and image columns (BLOB type columns)
OleDbDataAdapter internal error: invalid row set accessor: Ordinal=3 Status=UNSUPPORTEDCONVERSION.
Call stack:
at System.Data.OleDb.RowBinding.CreateAccessor(IAccessor iaccessor, Int32 flags, ColumnBinding[] bindings)
at System.Data.OleDb.OleDbDataReader.CreateAccessors(Boolean allowMultipleAccessor)
at System.Data.OleDb.OleDbDataReader.BuildMetaInfo()
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.OleDb.OleDbCommand.ExecuteReader()
at ConsoleApp1.Program.Main(String[] args) in C:\Users\...\source\repos\ConsoleApp1\ConsoleApp1\Program.cs:line 32
(This is not a new problem, .NET Framework OleDb threw the same exception)
Repro code:
var path = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
var myConnectionStringSQL = $"Provider=Microsoft.SQLSERVER.CE.OLEDB.4.0;Data Source={path}\\NorthwindEF7.sdf;";
using (var conSQL = new OleDbConnection(myConnectionStringSQL))
{
using (var cmdSQLQuery = new OleDbCommand())
{
conSQL.Open();
using (var cmdSQL = new OleDbCommand())
{
cmdSQL.CommandType = CommandType.Text;
cmdSQL.Connection = conSQL;
//This fails
cmdSQL.CommandText = "SELECT [CategoryID] ,[CategoryName] ,[Description] ,[Picture] FROM [Categories];";
//This works
//cmdSQL.CommandText = "SELECT [CategoryID] ,[CategoryName] FROM [Categories]";
var reader = cmdSQL.ExecuteReader();
reader.Read();
}
}
}
Table schema:
-- Script Date: 24/05/2019 09:44 - ErikEJ.SqlCeScripting version 3.5.2.80
CREATE TABLE [Categories] (
[CategoryID] int IDENTITY (9,1) NOT NULL
, [CategoryName] nvarchar(15) NOT NULL
, [Description] ntext NULL
, [Picture] image NULL
);
GO
ALTER TABLE [Categories] ADD CONSTRAINT [PK_Categories] PRIMARY KEY ([CategoryID]);
GO
CREATE INDEX [CategoryName] ON [Categories] ([CategoryName] ASC);
GO
I have attached a repro, install the SQL Server Compact 4.0 runtime MSI if it is not already installed.
Using .NET Core System.Data.OleDb with the SQL Server Compact provider throws this error, when reading ntext and image columns (BLOB type columns)
Call stack:
(This is not a new problem, .NET Framework OleDb threw the same exception)
Repro code:
Table schema:
I have attached a repro, install the SQL Server Compact 4.0 runtime MSI if it is not already installed.
ConsoleApp1.zip