你好,我有一個插入查詢,但問題是它鎖定數據庫它是唯一的連接到數據庫,但它保持鎖定沒有任何人有任何想法如何解決這是我唯一的腳本運行,它應該工作。任何插入查詢鎖SQLite
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;
}
}
我已經試過一切,甚至重新啓動我的電腦,並試圖在另一個項目。
如果任何人都可以請回到我儘快這將是巨大的感謝大家的期待
如果你沒有收到命令的結果,你應該使用'dbcmd.ExecuteNonQuery()'而不是'dbcmd.ExecuteReader()'。 – Elias
我會試試這個 – albaslayer
這個沒有工作,它仍然不執行查詢 – albaslayer