当前位置: 首页>>代码示例>>C#>>正文


C# SqliteConnection.Close方法代码示例

本文整理汇总了C#中Mono.Data.SqliteClient.SqliteConnection.Close方法的典型用法代码示例。如果您正苦于以下问题:C# SqliteConnection.Close方法的具体用法?C# SqliteConnection.Close怎么用?C# SqliteConnection.Close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mono.Data.SqliteClient.SqliteConnection的用法示例。


在下文中一共展示了SqliteConnection.Close方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: IGADatabaseConnector

        /// <summary>
        /// Creates a new connection to the icontent.cache file.
        /// </summary>
        /// <param name="filename">The file to connect to.</param>
        public IGADatabaseConnector(String filename)
        {
            try {
                sqlite = new SqliteConnection("URI=file:" + filename + ",version=3");
                sqlite.Open();

                SqliteCommand query = new SqliteCommand("SELECT [appId] FROM [contentlist] LIMIT 1", sqlite);
                Object result = query.ExecuteScalar();
                sqlite.Close();
                if (result == null)
                {
                    this._appID = 0;
                }
                else
                {
                    this._appID = (int)result;
                }

                if (this._appID > 0) {
                    this._appSupported = Common.AppInfos.ContainsKey(this._appID);
                } else {
                    this._appSupported = false;
                }

                if (this._appSupported)
                {
                    _appInfo = Common.AppInfos[this._appID];
                }

            } catch (Exception) {
                throw new DatabaseConnectionFailureException();
            }
        }
开发者ID:micolous,项目名称:igaeditor,代码行数:37,代码来源:IGADatabaseConnector.cs

示例2: Initialise

        public void Initialise(string connectionString)
        {
            m_connectionString = connectionString;

            m_log.Info("[ESTATE DB]: Sqlite - connecting: "+m_connectionString);

            m_connection = new SqliteConnection(m_connectionString);
            m_connection.Open();

            Assembly assem = GetType().Assembly;
            Migration m = new Migration(m_connection, assem, "EstateStore");
            m.Update();

            m_connection.Close();
            m_connection.Open();

            Type t = typeof(EstateSettings);
            m_Fields = t.GetFields(BindingFlags.NonPublic |
                                   BindingFlags.Instance |
                                   BindingFlags.DeclaredOnly);

            foreach (FieldInfo f in m_Fields)
                if (f.Name.Substring(0, 2) == "m_")
                    m_FieldMap[f.Name.Substring(2)] = f;
        }
开发者ID:AlexRa,项目名称:opensim-mods-Alex,代码行数:25,代码来源:SQLiteEstateData.cs

示例3: Start

    // Use this for initialization
    void Start()
    {

        //E:\Etude\Projet\Projet_4e_semestre\GITHUB\New_Unity_Project\Assets


        const string connectionString = "URI=file:E://Etude/Projet/Projet_4e_semestre/GITHUB/New_Unity_Project/Assets/testbdd.s3db";
        IDbConnection dbcon = new SqliteConnection(connectionString);
        IDbCommand dbcmd = dbcon.CreateCommand();
        try
        {
            dbcon.Open();

            const string sql = "select nomcarte from carte";
            dbcmd.CommandText = sql;
            IDataReader reader = dbcmd.ExecuteReader();
            while (reader.Read())
            {
                string NomCarte = reader.GetString(0);
                Debug.Log("Carte: " + NomCarte + "\n");
            }
            reader.Dispose();

        }
        catch (Exception ex)
        {
            Debug.Log(ex.Message);
        }
        dbcmd.Dispose();
        dbcon.Close();

    }
开发者ID:vnigaud,项目名称:Jeu_de_carte,代码行数:33,代码来源:connexion.cs

示例4: Start

    // Use this for initialization
    void Start () {
        const string connectionString = "URI=file:E://Etude/Projet/Projet_4e_semestre/GITHUB/New_Unity_Project/Assets/testbdd.s3db";
        IDbConnection dbcon = new SqliteConnection(connectionString);
        IDbCommand dbcmd = dbcon.CreateCommand();
        try
        {
            dbcon.Open();

            const string sql = "SELECT DISTINCT nomcarte, puisscrea, vitcrea, typecrea, pvcrea, nomatk, dommatk, vitatk FROM carte INNER JOIN creature ON creature.IDCARTE = carte.IDCARTE INNER JOIN j_crea_atk On j_crea_atk.IDCREA = creature.IDCARTE INNER JOIN atk On atk.IDATK = j_crea_atk.IDATK WHERE carte.IDCARTE = '1' AND atk.IDATK='1'";
            dbcmd.CommandText = sql;
            IDataReader reader = dbcmd.ExecuteReader();
            while (reader.Read())
            {
                IDCARTE = reader.GetInt32(0);
            }
            reader.Dispose();

        }
        catch (Exception ex)
        {
            Debug.Log(ex.Message);
        }
        dbcmd.Dispose();
        dbcon.Close();
    }
开发者ID:vnigaud,项目名称:Jeu_de_carte,代码行数:26,代码来源:CreationDeckEnJeu.cs

示例5: ExecuteSQL

 public static IDataReader ExecuteSQL(string db, string sql)
 {
     var connection = new SqliteConnection(db);
     connection.Open();
     var command = connection.CreateCommand();
     command.CommandText = sql;
     var result = command.ExecuteReader();
     connection.Close();
     return result;
 }
开发者ID:somers353,项目名称:gamedev-group1A,代码行数:10,代码来源:SQLiteConnector.cs

示例6: ExecuteNonQuery

 public new void ExecuteNonQuery(string sql, string connectionString)
 {
     using (SqliteConnection conn = new SqliteConnection(connectionString))
     {
         SqliteCommand cmd = new SqliteCommand(sql, conn);
         cmd.CommandTimeout = 1200;
         conn.Open();
         cmd.ExecuteNonQuery();
         conn.Close();
     }
 }
开发者ID:EntropyZero,项目名称:deltaRunner,代码行数:11,代码来源:SqliteTestFixtureBase.cs

示例7: ExecuteScalar

 public new object ExecuteScalar(string sql, string connectionString)
 {
     using (SqliteConnection conn = new SqliteConnection(connectionString))
     {
         SqliteCommand cmd = new SqliteCommand(sql, conn);
         cmd.CommandTimeout = 1200;
         conn.Open();
         object retVal = cmd.ExecuteScalar();
         conn.Close();
         return retVal;
     }
 }
开发者ID:EntropyZero,项目名称:deltaRunner,代码行数:12,代码来源:SqliteTestFixtureBase.cs

示例8: Convert

        public bool Convert()
        {
            try
            {
                SqliteConnection conn = new SqliteConnection(m_connectionString);
                conn.Open();

                Assembly assem = GetType().Assembly;
                Migration m = new Migration(conn, assem, "RegionStore");

                int version = m.Version;

                if (version <= 14)
                {
                    if (version == 0)
                    {
                        //read rex tables and add to rex database
                        m_log.Info("[regionstore] converting rex tables to rexobjectproperties");
                        if (!ConvertLegacyRexDataToModreX())
                        {
                            conn.Close();
                            return false;
                        }

                        m_log.Info("[RegionStore] Update region migrations");
                        //Add new field to Land table
                        SqliteCommand addAuthbyerIDCmd = new SqliteCommand(addAuthbyerID, conn);
                        addAuthbyerIDCmd.ExecuteNonQuery();

                        //Change migration to version 1
                        m.Version = 1;
                    }

                    //Run migrations up to 9
                    //Note: this run migrations only to point nine since only those files exist in application resources.
                    m.Update();

                    //Skip over 10. Change version to 10
                    //This skips adding of the ClickAction since that already exists in 0.4 database
                    //m.Version = 10;
                }

                conn.Close();
                return true;
            }
            catch (Exception e)
            {
                m_log.ErrorFormat("[RegionStore] Migration failed. Reason: {0}", e);
                return false;
            }
        }
开发者ID:mattire,项目名称:ModreX,代码行数:51,代码来源:RegionMigration.cs

示例9: addauto

    //Diese Methode Schreibt ein Gegebenes Auto in die Datenbank.
    // Das Auto wird als Parameter gegeben
    public void addauto(Autos autodaten)
    {
        IDbConnection _connection = new SqliteConnection(_strDBName);
        IDbCommand _command = _connection .CreateCommand();
        string sql;

        _connection .Open();

        sql = "INSERT INTO AUTOS (KENNZEICHEN, STATUS) Values ('"+ autodaten.getKennzeichen ()+"','"+autodaten.getStatus ()+"')";
        _command.CommandText = sql;
        _command.ExecuteNonQuery();

        _command.Dispose();
        _command = null;
        _connection .Close();
        _connection.Dispose ();
        _connection = null;
        //Debug.Log (autodaten.getKennzeichen ());
    }
开发者ID:Namamiri,项目名称:Parkplatzdrohne,代码行数:21,代码来源:Database.cs

示例10: Select

    public ArrayList Select(string quer)
    {
        Resultd = new ArrayList();
        string connectionString = "URI=file:" + Application.dataPath + "/Qjournaldb.s3db";
        IDbConnection dbcon = new SqliteConnection(connectionString);
        dbcon.Open();
        IDbCommand dbcmd = dbcon.CreateCommand();
        dbcmd.CommandText = quer;
        IDataReader reader = dbcmd.ExecuteReader();
        while (reader.Read())
        {
            Resultd.Add(reader.GetString(2));
            //Debug.Log(reader.GetString(2));
        }

        // clean up
        reader.Dispose();
        dbcmd.Dispose();
        dbcon.Close();
        return Resultd;
    }
开发者ID:neroes,项目名称:Phone-App-Project-1,代码行数:21,代码来源:Db.cs

示例11: abfrageexisttabelle

 // Hier wird überprüft ob eine bestimmte Tabelle in der Datenbank existieren. Die Anzahl der Funde wird Zurückgegeben. 1=Existiert; 0=Gibt es nicht
 public int abfrageexisttabelle(string Tabellenname)
 {
     IDbConnection _connection = new SqliteConnection(_strDBName);
     IDbCommand _command = _connection .CreateCommand();
     string sql;
     IDataReader _reader;
     _connection .Open();
     sql = "SELECT count(name) as Count FROM sqlite_master WHERE type='table' AND name='"+Tabellenname+"'";
     _command.CommandText = sql;
     _reader = _command.ExecuteReader();
     _reader.Read ();
     _connection .Close();
     _connection.Dispose ();
     _connection = null;
     _command.Dispose ();
     _command = null;
     int anzahl = System.Convert.ToInt32 (_reader ["Count"]);
     _reader.Close();
     _reader.Dispose ();
     _reader = null;
     return anzahl;
 }
开发者ID:Namamiri,项目名称:Parkplatzdrohne,代码行数:23,代码来源:Database.cs

示例12: Convert

        public bool Convert()
        {
            try
            {
                SqliteConnection conn = new SqliteConnection(m_connectionString);
                conn.Open();

                Assembly assem = GetType().Assembly;
                Migration m = new Migration(conn, assem, "UserStore");

                if (m.Version == 0)
                {
                    m.Version = 1;
                }

                conn.Close();
                return true;
            }
            catch (Exception e)
            {
                m_log.ErrorFormat("[UserStore] Migration failed. Reason: {0}", e);
                return false;
            }
        }
开发者ID:mattire,项目名称:ModreX,代码行数:24,代码来源:UserProfileMigration.cs

示例13: InitializeDatabase

    /// <summary>Creates the database if necessary and returns the current
    /// iteration.</summary>
    protected int InitializeDatabase()
    {
      IDbConnection dbcon = new SqliteConnection(_db_con);
      dbcon.Open();
      IDbCommand dbcmd = dbcon.CreateCommand();
      string sql = "CREATE TABLE crawl (iter INTEGER, Address TEXT, Hits INTEGER, " +
        "Rtt REAL, Hops REAL)";
      dbcmd.CommandText = sql;
      try {
        dbcmd.ExecuteNonQuery();
      } catch {
      }

      sql = "CREATE TABLE iterations (iter INTEGER, time INTEGER)";
      dbcmd.CommandText = sql;
      try {
        dbcmd.ExecuteNonQuery();
      } catch {
      }

      // Set _current_iter to how many iterations there exist already
      sql = "SELECT iter FROM iterations";
      dbcmd.CommandText = sql;
      int current_iter = dbcmd.ExecuteNonQuery();
      dbcmd.Dispose();

      dbcon.Close();
      return current_iter;
    }
开发者ID:pstjuste,项目名称:brunet,代码行数:31,代码来源:NetworkTest.cs

示例14: init

    public void init(int idcarte, string numserie, int idatk, int idatk2)
    {
        this.idcarte = idcarte;
        this.numserie = numserie;

        xdeck = this.transform.position.x;
        ydeck = this.transform.position.y;
        zdeck = this.transform.position.z;
        ObservJ1 = false;
        ObservJ2 = false;

        mettredsdeck = false;

        const string connectionString = "URI=file:E://Etude/Projet/Projet_4e_semestre/GITHUB/New_Unity_Project/Assets/testbdd.s3db";

        IDbConnection dbcon = new SqliteConnection(connectionString);
        IDbCommand dbcmd = dbcon.CreateCommand();
        try
        {
            dbcon.Open();

            string sql = "SELECT DISTINCT nomcarte, puisscrea, vitcrea, typecrea, pvcrea, nomatk, dommatk, vitatk FROM carte INNER JOIN creature ON creature.IDCARTE = carte.IDCARTE INNER JOIN j_crea_atk On j_crea_atk.IDCREA = creature.IDCARTE INNER JOIN atk On atk.IDATK = j_crea_atk.IDATK WHERE carte.NUMSERIE = '" + this.numserie + "' AND atk.IDATK=" + this.idatk + "";

            dbcmd.CommandText = sql;
            IDataReader reader = dbcmd.ExecuteReader();
            while (reader.Read())
            {
                NomCarte = reader.GetString(0);
                puisscrea = reader.GetInt32(1);
                vitcrea = reader.GetInt32(2);
                typecrea = reader.GetString(3);
                pvcrea = reader.GetInt32(4);
                nomatk = reader.GetString(5);
                dommatk = reader.GetInt32(6);
                vitatk = reader.GetInt32(7);
            }
            reader.Dispose();

            string sql2 = "SELECT DISTINCT nomcarte, puisscrea, vitcrea, typecrea, pvcrea, nomatk, dommatk, vitatk FROM carte INNER JOIN creature ON creature.IDCARTE = carte.IDCARTE INNER JOIN j_crea_atk On j_crea_atk.IDCREA = creature.IDCARTE INNER JOIN atk On atk.IDATK = j_crea_atk.IDATK WHERE carte.NUMSERIE = '" + this.numserie + "' AND atk.IDATK=" + this.idatk2 + "";
            dbcmd.CommandText = sql2;

            IDataReader reader2 = dbcmd.ExecuteReader();
            while (reader2.Read())
            {
                nomatk2 = reader2.GetString(5);
                dommatk2 = reader2.GetInt32(6);
                vitatk2 = reader2.GetInt32(7);
            }
            reader2.Dispose();
        }
        catch (Exception ex)
        {
            Debug.Log(ex.Message);
        }
        dbcmd.Dispose();
        dbcon.Close();

    }
开发者ID:vnigaud,项目名称:Jeu_de_carte,代码行数:58,代码来源:ScriptCarteEffet.cs

示例15: OnGUI

    /// <summary>
    /// ////////////////////////////////////////Les fonctions liées aux gui
    /// </summary>

    void OnGUI()
    {
        //Debug.Log(idcarte);
        if (ObservJ1 == true)
        {
            if (GUI.Button(new Rect(710, 50, 200, 100), "Mettre dans le Deck"))
            {
                const string connectionString = "URI=file:E://Etude/Projet/Projet_4e_semestre/GITHUB/New_Unity_Project/Assets/testbdd.s3db";
                IDbConnection dbcon = new SqliteConnection(connectionString);
                IDbCommand dbcmd = dbcon.CreateCommand();
                try
                {
                    dbcon.Open();
                    string sql5 = "INSERT INTO j_deck_carte (IDDECK,IDCARTE) VALUES ('1'," + this.idcarte + ")";
                    dbcmd.CommandText = sql5;
                    IDataReader reader5 = dbcmd.ExecuteReader();
                    while (reader5.Read())
                    {
                    }
                    reader5.Dispose();
                }
                catch (Exception ex)
                {
                    Debug.Log(ex.Message);
                }
                dbcmd.Dispose();
                dbcon.Close();
            }
            if (GUI.Button(new Rect(710, 270, 200, 100), "Enlever du Deck"))
            {
                idcartebddJ1 = 0;
                const string connectionString = "URI=file:E://Etude/Projet/Projet_4e_semestre/GITHUB/New_Unity_Project/Assets/testbdd.s3db";
                IDbConnection dbcon = new SqliteConnection(connectionString);
                IDbCommand dbcmd = dbcon.CreateCommand();
                try
                {
                    dbcon.Open();
                    string sql6 = "DELETE FROM j_deck_carte WHERE IDDECK='1' AND IDCARTE='" + this.idcarte + "'";
                    dbcmd.CommandText = sql6;
                    IDataReader reader6 = dbcmd.ExecuteReader();
                    while (reader6.Read())
                    {
                    }
                    reader6.Dispose();
                }
                catch (Exception ex)
                {
                    Debug.Log(ex.Message);
                }
                dbcmd.Dispose();
                dbcon.Close();
            }
            if (GUI.Button(new Rect(710, 490, 200, 100), "Reposer"))
            {
                this.gameObject.transform.position = new Vector3(xdeck, ydeck, zdeck);
                ObservJ1 = false;
            }

        }


        if (ObservJ2 == true)
        {
            if (GUI.Button(new Rect(710, 50, 200, 100), "Mettre dans le Deck"))
            {
                const string connectionString = "URI=file:E://Etude/Projet/Projet_4e_semestre/GITHUB/New_Unity_Project/Assets/testbdd.s3db";
                IDbConnection dbcon = new SqliteConnection(connectionString);
                IDbCommand dbcmd = dbcon.CreateCommand();
                try
                {
                    dbcon.Open();
                    string sql7 = "INSERT INTO j_deck_carte (IDDECK,IDCARTE) VALUES ('2','" + this.idcarte + "')";
                    dbcmd.CommandText = sql7;
                    IDataReader reader7 = dbcmd.ExecuteReader();
                    while (reader7.Read())
                    {
                    }
                    reader7.Dispose();
                }
                catch (Exception ex)
                {
                    Debug.Log(ex.Message);
                }
                dbcmd.Dispose();
                dbcon.Close();
            }
            if (GUI.Button(new Rect(710, 270, 200, 100), "Enlever du Deck"))
            {
                idcartebddJ2 = 0;
                const string connectionString = "URI=file:E://Etude/Projet/Projet_4e_semestre/GITHUB/New_Unity_Project/Assets/testbdd.s3db";
                IDbConnection dbcon = new SqliteConnection(connectionString);
                IDbCommand dbcmd = dbcon.CreateCommand();
                try
                {
                    dbcon.Open();
                    string sql8 = "DELETE FROM j_deck_carte WHERE IDDECK='2' AND IDCARTE='" + this.idcarte + "'";
//.........这里部分代码省略.........
开发者ID:vnigaud,项目名称:Jeu_de_carte,代码行数:101,代码来源:ScriptCarteEffet.cs


注:本文中的Mono.Data.SqliteClient.SqliteConnection.Close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。