In my C# program I need to use DataReader to retrieve Guids from Sqlite database where they are stored as bianries.
I tried the following code but it failed to convert the ClassId to Guid.
using (IDataReader dataReader = DatabaseConnection.ExecuteReader(_getFileCountByClassCommand, new Dictionary<string, object>()))
{
while(dataReader.Read())
{
string str = Convert.ToString(dataReader["ClassId"]);
fileCount.Add(new Guid(str), (int)dataReader["FileCount"]);
}
}
Anybody knows how to do this? Thanks,
Have you tried using SqlDataReader.GetGuid
You don’t need to convert to string and back again to a Guid