Hi guys
In editor everything works fine but the problem is in android device.
The .db
file copy in Application.PersistentDataPath
but SqliteConnection
cant connect to .db, it’s doesn’t give any error but doesn’t read value from .db, too.
please help
this is my code:
StrConnection = "URI=file:" + Application.persistentDataPath + "/" + _DBName;
if (System.IO.File.Exists (Application.persistentDataPath + "/" + _DBName))
_txtShowUI.text += "Database Exist
";
else
_txtShowUI.text += "Database Not Found
";
using (IDbConnection dbConnection = new SqliteConnection(StrConnection))
{
_txtShowUI.text += StrConnection + "
";
dbConnection.Open();
_txtShowUI.text += dbConnection.State.ToString() + "
";
using(IDbCommand dbCmd = dbConnection.CreateCommand())
{
string sqlQuery = “SELECT * FROM tbl_01”;
dbCmd.CommandText = sqlQuery;
using(IDataReader reader = dbCmd.ExecuteReader())
{
while(reader.Read())
{
_txtShowUI.text += reader.GetInt32(0) + ". " + reader.GetString(1) + " " + reader.GetString(2) + "
";
}
reader.Close();
}
}
dbConnection.Close();
}