In Visual Studio (same issue in 2013 & 2015 Editions), I am getting this error when building my project:
The type 'DbConnection' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data, Version=4.0.0.0
I am doing this as I would like to use the MySQL.Data
package, but it seems to require System.Data
.
However, in my project there is no way to add System.Data
to my references, it is not in the list of references so I cannot 'tick' it to add it to the project. This is a Xamarin C#
solution, and the project that does not list System.Data
is a PCL.
Does this affect the packages? If so, is there some way to work around this or get MySQL.Data working without this?
I think a better approach is to not connect from your application directly to the database ( 2-tier
), but define a Web service
to consume and that Web service will connect to the database ( 3-tier
).
Thus, Xamarin C#
does not require reference to System.Data. One option is to use JSON
as a data format for communication.
More details about this problem are discussed here .
I know this is an old question but i solved it by just upgrading my project .Net Framework to 4.5.
I got this issue when using Postgres Driver (Npgsql) which requires at least this framework version.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.