lundi 22 juin 2015

Any Insert Query Locks SQLite

Hello I have a insert query but the problem is it locks the database it is the only connection to the database yet it stays locked does anyone have any idea how to fix it this is the only script i have running and it should work.

using UnityEngine;
using System.Collections;
using Parse;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using Mono.Data.Sqlite; 
using System.Data; 



public class ParseInputId : MonoBehaviour {



    void Start()
    {       

        string conn = "";
        string Question;
        //string sqlQuery;
        #if UNITY_EDITOR

        conn = "URI=file:" + Application.persistentDataPath + "/" + "App.db";
        Debug.Log (conn);
        #elif UNITY_IPHONE
        conn = "URI=file:" + Application.persistentDataPath + "/" + "App.db";
        #elif UNITY_ANDROID
        conn = "URI=file:" + Application.persistentDataPath + "/" + App.db";
        #endif
        //string conn = "URI=file:" + Application.dataPath + "/App.db"; //Path to database.




            string toreplace;
            IDbConnection dbconn;
            dbconn = (IDbConnection) new SqliteConnection(conn);
            dbconn.Open(); //Open connection to the database.
            IEnumerable<ParseObject> results = t.Result;



                IDbCommand dbcmd = dbconn.CreateCommand();




        string sqlQuery = "INSERT INTO TEST (Field1) Values (1)";
                Debug.Log (sqlQuery);

                dbcmd.CommandText = sqlQuery;
                IDataReader reader = dbcmd.ExecuteReader();
                reader.Close();
                reader = null;
                dbcmd.Dispose();
                dbcmd = null;


            dbconn.Close();
            dbconn = null;  


    }


}

I have tried everything even restarting my computer and trying on another project.

if anyone can please get back to me asap it would be great thank you all for looking

Aucun commentaire:

Enregistrer un commentaire