0
votes

I'm trying to fetch some data from Db2 Database using .NET Core 2.1

The problem is that i'm getting Byte[] instead of string as a result of my query :

using(var cmd = Connection.CreateCommand())
{
    cmd.CommandText = GET_OPERATIONS_QUERY;

    using(var reader = cmd.ExecuteReader())
    {
        if (reader.Read())
            Console.WriteLine(reader.GetString(0));
    }
}

I have already encountered this problem but it was with

IBM.Data.DB2.iSeries

The solution was to set the property CharBitDataAsString to true

iDB2ProviderSettings.CharBitDataAsString = true;

So how to do this with

  • .Net Core 2.1
  • IBM.Data.DB2.Core 1.3.0.100
1

1 Answers

0
votes

You can set it in your connection string, just add a ;CharBitDataAsString=true to the end of it.