lundi 16 mars 2015

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

I am trying to use a SQLite database with my Windows store app I am creating.


Below is a data class that is initialized when the app starts:



public class DataLayer
{
SQLiteConnection m_dbConnection;
public DataLayer()
{
createDatabase();
}

public void createDatabase()
{
SQLiteConnection.CreateFile("QTabs.sqlite");
m_dbConnection = new SQLiteConnection("Data Source=QTabs.sqlite;Version=3;");
m_dbConnection.Open();
StringBuilder creatTables = new StringBuilder();
//Append all SQL tables
creatTables.Append("CREATE TABLE SyncTime (SyncTime_ID INTEGER PRIMARY KEY AUTOINCREMENT, SyncTime DATETIME);");
SQLiteCommand command = new SQLiteCommand(creatTables.ToString(), m_dbConnection);
command.ExecuteNonQuery();
m_dbConnection.Close();
}
}


All I'm trying to do is have a database created and filled with a table.


But I'm getting this error:


enter image description here


"Error 1 The type 'System.Data.Common.DbConnection' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. C:\Users\tunnelld\Documents\Visual Studio 2013\Projects\QTabs 0.1 sqlite retry\QTabs\DataLayer.cs 14 25 QTabs"


I'm using System.Data:



using System.Data;
using System.Data.SQLite;


What is going on here? How do I fix this?


Edit: I don't see any references to add.


enter image description here


Aucun commentaire:

Enregistrer un commentaire