Home

Published

- 1 min read

c# sqlite Specified cast is not valid.

img of c# sqlite Specified cast is not valid.

The solution for this is noted below

c# sqlite Specified cast is not valid.

Solution

   // Mostly likely, that you read DbNull from database, which cannot be cast
// to bool.

// Solution below
if (reader.IsDBNull(2) == false)
{
	brandName = reader.GetString(2);
}

Try other methods by searching on the site. That is if this doesn’t work