Question by
unity_qtlpPC6juuQVkQ · Nov 20, 2020 at 10:58 AM ·
databasesqlite
How can I solve these errors in SQlite?
no matter how much I think about it, I can't fix that problem
===================================================
using System.Collections; using System.Collections.Generic; using UnityEngine; using Mono.Data.Sqlite; using System.Data; using System;
public class Db : MonoBehaviour { void DBTest() { string conn = "URI=file:" + Application.dataPath + "/Plugins/Recetas.db"; IDbConnection dbconn; dbconn = (IDbConnection)new SqliteConnection(conn); dbconn.Open();
IDbCommand dbcmd = dbconn.CreateCommand();
string sqlQuery = "SELECT value,name, randomSequence " + "FROM PlaceSequence";
dbcmd.CommandText = sqlQuery;
IDataReader reader = dbcmd.ExecuteReader();
while (reader.Read())
{
int value = reader.GetInt32(0);
string name = reader.GetString(1);
int rand = reader.GetInt32(2);
Debug.Log("value= " + value + " name =" + name + " random =" + rand);
}
reader.Close();
reader = null;
dbcmd.Dispose();
dbcmd = null;
dbconn.Close();
dbconn = null;
}
}
Comment