- Home /
DllNotFoundException: sqlite3 IOS
i have been following this tutorial https://www.youtube.com/watch?v=ONi0M4PyXE0&t=699s
I'm required to use a database.
im having issues getting data to display.
the sqlite3.dll is in the Plugins folder
. error code: DllNotFoundException: sqlite3 Mono.Data.Sqlite.SQLite3.Open (System.String strFilename, Mono.Data.Sqlite.SQLiteOpenFlagsEnum flags, System.Int32 maxPoolSize, System.Boolean usePool) (at :0) Mono.Data.Sqlite.SqliteConnection.Open () (at :0)
. code:
using System.Collections; using System.Collections.Generic; using UnityEngine; using Mono.Data.Sqlite; using System.Data; using System;
public class DB : MonoBehaviour { private void Start() { ReadDatabase(); }
void ReadDatabase()
{
string conn = "URI=file:" + Application.dataPath + "/DB.db"; //Path to database.
IDbConnection dbconn;
dbconn = (IDbConnection)new SqliteConnection(conn);
dbconn.Open(); //Open connection to the database.
IDbCommand dbcmd = dbconn.CreateCommand();
string sqlQuery = "SELECT ID, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8,Q9 " + "FROM Remote Associates";
dbcmd.CommandText = sqlQuery;
IDataReader reader = dbcmd.ExecuteReader();
while (reader.Read())
{
int ID = reader.GetInt32(0);
string Q1 = reader.GetString(1);
string Q2 = reader.GetString(2);
string Q3 = reader.GetString(3);
string Q4 = reader.GetString(4);
string Q5 = reader.GetString(5);
string Q6 = reader.GetString(6);
string Q7 = reader.GetString(7);
string Q8 = reader.GetString(8);
string Q9 = reader.GetString(9);
Debug.Log("ID= " + ID + " Q1 =" + Q1 + " Q2 =" + Q2 + " Q3 =" + Q3 + " Q4 =" + Q4 + " Q5 =" + Q5 + " Q6 =" + Q6 + " Q7 =" + Q7 + " Q8 =" + Q8 + " Q9 =" + Q9);
}
reader.Close();
reader = null;
dbcmd.Dispose();
dbcmd = null;
dbconn.Close();
dbconn = null;
}
}
Comment