- Home /
Database Error (Sqlite) in unity 4.0
Assets/Scripts/Database.js(12,21): BCE0018: The name 'IDbConnection' does not denote a valid type ('not found'). Did you mean 'System.Runtime.InteropServices.ComTypes.ITypeComp'?
Assets/Scripts/Database.js(13,21): BCE0018: The name 'IDbCommand' does not denote a valid type ('not found'). Did you mean 'System.Runtime.InteropServices.ComTypes.ITypeComp'?
Assets/Scripts/Database.js(14,22): BCE0018: The name 'IDataReader' does not denote a valid type ('not found').
Have you import
the necessary package containing the definition of IDbConnection
?
Yes , I have imported necessary packages.
import UnityEngine;
import System;
import System.Collections;
import System.Data;
import System.Data.Linq;
import $$anonymous$$ono.Data.Sqlite;
import DbLinq;
Also , If i put my script in Plugins/Editor folder or Assets/Editor folder , the errors are gone. But then I cant access this script in other scripts . I dont understand this.
static var databaseName : String = "my_db.sqlite";
class Database
{
var connection : String;
var dbcon : IDbConnection;
var dbcmd : IDbCommand;
var reader : IDataReader;
function OpenDB()
{
if(Application.platform == RuntimePlatform.IPhonePlayer)
{
connection = "URI=file:" + Application.dataPath.Replace("/Data","/") + databaseName;
//connection = "URI=file:" + Application.persistentDataPath + "/" + databaseName;
}
else
{
connection = "URI=file:" + databaseName;
}
Debug.Log("DB Path : " + connection);
dbcon.Open();
}
}
After putting my script in Editor folder, All errors are gone. Then I access my script as following :
var db : Database = new Database(); db.OpenDB();
And I got the error :
BCE0018: The name 'Database' does not denote a valid type ('not found').
Answer by Foram · Jul 09, 2013 at 05:07 AM
Put Mono.Data.Sqlite.dll , Mono.Data.SqliteClient.dll , sqlite3.dll and System.Data.dll into Plugins folder.
Dont put Database in Editor Folder. Put it anywhere else
Your answer
Follow this Question
Related Questions
Linq Query - Strange Outcome 1 Answer
SQL connection problem 0 Answers
Calling Json script and displaying the Images within the script 0 Answers
Alternative to storing data in DB's 2 Answers
Storing Constant data in a mobile game 0 Answers