سؤال

I am trying to use the Zumero Xamarin component, but I get a compiler error.

The type 'System.Data.Common.DbConnection' is defined in an assembly that is not referenced.

I included the component to my project and added the following code.

using System.Data.SQLite;

And

        string personalFolder = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
        string dbName = "pitches.db";
        string dbPath = Path.Combine ( personalFolder, dbName);
        var conn = new  SQLiteConnection ("Data Source=" + dbPath); 
        conn.Open (); 
        conn.ZumeroRegister();

enter image description here

هل كانت مفيدة؟

المحلول

  1. Following the same steps, this problem happens for me as well.

  2. If I then add a reference to System.Data, the error goes away and the code compiles. Looking at your screenshot, it appears that you do not have a reference to System.Data. Under the Project menu, choose Edit References, make sure the All tab is open, and then put a checkmark next to System.Data.

  3. I am using the recently-released Xamarin.iOS 6.4. I don't remember needing to do this step before, which suggests that perhaps previous versions of Xamarin.iOS included the reference to System.Data by default. I've got a little uncertainty here yet that needs to be eliminated.

I hope this helps.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top