Search code examples
c#.netentity-frameworktargetinvocationexception

C# Entity Framework "An unhandled exception of type 'System.Reflection.TargetInvocationException' occurred in EntityFramework.dll"


I'm building a simple login form using VS2015, C#, SQLite DB and entity Framework (under .net framework 4)

when I enter a valid user and password I get this exception

An unhandled exception of type 'System.Reflection.TargetInvocationException' occurred in EntityFramework.dll
Additional information: Exception has been thrown by the target of an invocation.

this is my DB :
http://www11.0zz0.com/2016/09/03/23/934209903.png

this is my User Class :
http://www11.0zz0.com/2016/09/03/23/937963117.png

this is the exception :
http://www11.0zz0.com/2016/09/03/23/381133631.png
http://www11.0zz0.com/2016/09/03/23/355831822.png

I tried everything i know .. but i did not succeeded Does any one know how to solve this problem ?


Solution

  • Finally I found the problem. The type BOOLEAN in SQLite is not very compatible with C# type 'bool' ... I have changed it to int instead and it worked as magic. Thank you mr robor78