I have a xamarin.forms project. In the PCL I have a class with these 3 lines of code ....
1) SqlCommand cmd = new SqlCommand(); .... (Note: this line of code works)
2) cmd.Parameters.Add(new SqlParameter("@UserID", SqlDbType.Char, 5)).Direction = ParameterDirection.Input; .... (Note: this line of code works)
3) var userid = cmd.Parameters["@UserID"].Value; .... (Note: this line of code DOES NOT work)
I am receiving this message ...
"Reference by type "MarshalByRefObject" claims it is defined in 'mscorlib', but could not be found
these 3 lines of code work in the Android specific project but not in the PCL class
I can ADD the parameters to the SqlCommand in the PCL class but CANNOT retrieve a value
thanks in advance for your help
The DLL you referenced is for Mono.Android project only, not for a PCL project. It can not be used in a PCL project. For explaination, please refer to this case.
If you want to use Native Android SQLite in PCL, please use Dependency Service:
In your PCL Project. Create an interface(
ISQLDb) for your Dependency Service and use the Service withDependencyService.Get<ISQLDb>():Create a class for Service Implementation in Mono.Android project and register it as Dependency Service: