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


C# SqliteConnection类代码示例

本文整理汇总了C#中SqliteConnection的典型用法代码示例。如果您正苦于以下问题:C# SqliteConnection类的具体用法?C# SqliteConnection怎么用?C# SqliteConnection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: btnIN_Click

        /// <summary>
        /// Добавя категория
        /// </summary>
        private void btnIN_Click(object sender, EventArgs e)
        {
            if ((cbTNCategoriesSub.SelectedValue == null)
              || cbTNCategoriesSub.SelectedValue.ToString().Equals(""))
            { return; }
            if (dgvCatOUT.CurrentRow == null)
            { return; }
            Int32 iCategoryID = Convert.ToInt32(dgvCatOUT.CurrentRow.Cells["gcCategoryID_OUT"].Value);
            try
            {
                using (SqliteConnection sqlCnnctn = new SqliteConnection())
                {
                    sqlCnnctn.ConnectionString = _ConnectionString;
                    sqlCnnctn.Open();

                    using (SqliteCommand sqlCmmnd = new SqliteCommand())
                    {
                        sqlCmmnd.Connection = sqlCnnctn;
                        sqlCmmnd.CommandText =
                            "UPDATE x_news_nweb " +
                            "    SET nweb_category_id = " + cbTNCategoriesSub.SelectedValue.ToString() +
                            " WHERE news_category_id = " + iCategoryID.ToString();
                        sqlCmmnd.ExecuteNonQuery();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            cbTNCategoriesSub_SelectedIndexChanged(null, null);
        }
开发者ID:DMSys,项目名称:DotNetUtility,代码行数:35,代码来源:UCCategories.cs

示例2: Initialise

        public void Initialise(string connectionString)
        {
            if (Util.IsWindows())
                Util.LoadArchSpecificWindowsDll("sqlite3.dll");

            m_connectionString = connectionString;

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

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

            Migration m = new Migration(m_connection, Assembly, "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:JAllard,项目名称:opensim,代码行数:27,代码来源:SQLiteEstateData.cs

示例3: Initialise

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

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

            m_connection = new SqliteConnection(m_connectionString);
            try
            {
                m_connection.Open();
            }
            catch (Exception ex)
            {
                throw new Exception("SQLite has errored out on opening the database. If you are on a 64 bit system, please run OpenSim.32BitLaunch.exe and try again. If this is not a 64 bit error :" + ex);
            }

            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:NickyPerian,项目名称:Aurora,代码行数:32,代码来源:SQLiteEstateData.cs

示例4: 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:BackupTheBerlios,项目名称:seleon,代码行数:25,代码来源:SQLiteEstateData.cs

示例5: QueryCache

        public QueryCache(SqliteConnection connection)
        {
            this.updateCommands = new MappingCommandDictionary();
            this.insertCommands = new InsertCommandDictionary();
            this.cachedCommands = new CommandDictionary();

            this.Connection = connection;
        }
开发者ID:guidoDimasi,项目名称:Mono.Data.Sqlite.Orm,代码行数:8,代码来源:QueryCache.cs

示例6: OpenConnection

        public static SqliteConnection OpenConnection(string connectionString)
        {
            SqliteConnection connection = new SqliteConnection();
            connection.ConnectionString = connectionString;
            connection.Open();

            return connection;
        }
开发者ID:DMSys,项目名称:DotNetUtility,代码行数:8,代码来源:dUtils.cs

示例7: CreateCrypted

        public void CreateCrypted(string databaseFile)
        {
            try
             {

            // Check if database already exists
            if (!File.Exists (databaseFile))
            {

               // Create the database
               SqliteConnection.CreateFile (databaseFile);

               // Connect to the database

               // using (SqliteConnection sqlCon = GetConnection (String.Format ("Data Source = {0};", databaseFile),"haluk"))
               using (SqliteConnection sqlCon = new SqliteConnection (String.Format ("Data Source = {0}", databaseFile)))

               {
                  sqlCon.SetPassword("haluk");
                  sqlCon.Open ();

                  // Create a table
                  using (SqliteCommand sqlCom = new SqliteCommand (sqlCon))
                  {
                     sqlCom.CommandText = "CREATE TABLE Personel (ID INTEGER PRIMARY KEY, UserName VARCHAR(20), Password VARCHAR(20))";
                     //veri Ekleme
                     //Update
                     //   sqlCom.CommandText = "UPDATE Customers SET FirstName= 'Haluk' WHERE LastName = @lastName";
                     // sqlCom.Parameters.Add(new SqliteParameter("@lastName","Haluky"));

                     sqlCom.ExecuteNonQuery ();

                     Console.WriteLine(sqlCom.ExecuteNonQuery());
                  }
                  //end using sqlCom

                  sqlCon.Close ();

               }
               //end using sqlCon

               this.durumGostericiT.Text = "Database hazır!";

            }else
            {

               this.durumGostericiT.Text = "Database Mevcut!";

            }//end if else

             } catch (Exception ex)
             {

            this.durumGostericiT.Text = String.Format ("Sqlite error: {0}", ex.Message);

             }//end try catch
        }
开发者ID:hhempel,项目名称:StoryboardTables,代码行数:57,代码来源:CryptX.cs

示例8: Fill

 public static int Fill(string commandText, SqliteConnection connection, DataTable dataTable)
 {
     int res = 0;
     using (SqliteCommand command = new SqliteCommand())
     {
         command.Connection = connection;
         command.CommandText = commandText;
         using (SqliteDataAdapter sqlDAdapter = new SqliteDataAdapter(command))
         {
             res = sqlDAdapter.Fill(dataTable);
         }
     }
     return res;
 }
开发者ID:DMSys,项目名称:DotNetUtility,代码行数:14,代码来源:dUtils.cs

示例9: AssertConnectionOpens

        private static void AssertConnectionOpens(string connectionString, string expectedPath)
        {
            if (File.Exists(expectedPath))
            {
                File.Delete(expectedPath);
            }

            using (var connection = new SqliteConnection(connectionString))
            {
                connection.Open();
                Assert.Equal(expectedPath, connection.DataSource);
            }

            Assert.True(File.Exists(expectedPath));
        }
开发者ID:carloserodriguez2000,项目名称:Microsoft.Data.Sqlite,代码行数:15,代码来源:SqliteConnectionTest.cs

示例10: Initialise

        /// <summary>
        /// <list type="bullet">
        /// <item>Initialises AssetData interface</item>
        /// <item>Loads and initialises a new SQLite connection and maintains it.</item>
        /// <item>use default URI if connect string is empty.</item>
        /// </list>
        /// </summary>
        /// <param name="dbconnect">connect string</param>
        override public void Initialise(string dbconnect)
        {
            if (dbconnect == string.Empty)
            {
                dbconnect = "URI=file:Asset.db,version=3";
            }
            m_conn = new SqliteConnection(dbconnect);
            m_conn.Open();

            Assembly assem = GetType().Assembly;
            Migration m = new Migration(m_conn, assem, "AssetStore");
            m.Update();

            return;
        }
开发者ID:NickyPerian,项目名称:Aurora,代码行数:23,代码来源:SQLiteAssetData.cs

示例11: Initialise

 public void Initialise(string connectionString)
 {
     if (Util.IsWindows())
         Util.LoadArchSpecificWindowsDll("sqlite3.dll");
     
     m_connectionString = connectionString;
     
     m_log.Info("[PROFILES_DATA]: Sqlite - connecting: "+m_connectionString);
     
     m_connection = new SqliteConnection(m_connectionString);
     m_connection.Open();
     
     Migration m = new Migration(m_connection, Assembly, "UserProfiles");
     m.Update();
 }
开发者ID:justasabc,项目名称:opensim76,代码行数:15,代码来源:SQLiteUserProfilesData.cs

示例12: ExecuteReader

        protected IDataReader ExecuteReader(SqliteCommand cmd, SqliteConnection connection)
        {
            lock (connection)
            {
                //SqliteConnection newConnection =
                //        (SqliteConnection)((ICloneable)connection).Clone();
                //newConnection.Open();

                //cmd.Connection = newConnection;
                cmd.Connection = connection;
                //Console.WriteLine("XXX " + cmd.CommandText);

                return cmd.ExecuteReader();
            }
        }
开发者ID:BackupTheBerlios,项目名称:seleon,代码行数:15,代码来源:SQLiteFramework.cs

示例13: SQLiteAuthenticationData

        public SQLiteAuthenticationData(string connectionString, string realm)
                : base(connectionString)
        {
            m_Realm = realm;

            if (!m_initialized)
            {
                m_Connection = new SqliteConnection(connectionString);
                m_Connection.Open();

                Migration m = new Migration(m_Connection, Assembly, "AuthStore");
                m.Update();

                m_initialized = true;
            }
        }
开发者ID:NovaGrid,项目名称:opensim,代码行数:16,代码来源:SQLiteAuthenticationData.cs

示例14: LoadNews

        public void LoadNews()
        {
            try
            {
                using (SqliteConnection sqlCnnctn = new SqliteConnection())
                {
                    sqlCnnctn.ConnectionString = _ConnectionString;
                    sqlCnnctn.Open();
                    //
                    using (SqliteCommand sqlCmmndNews = new SqliteCommand())
                    {
                        using (SqliteCommand sqlCmmndEncl = new SqliteCommand())
                        {
                            sqlCmmndNews.Connection = sqlCnnctn;
                            sqlCmmndEncl.Connection = sqlCnnctn;

                            // сваля и зарежда новините
                            foreach (NewsSource ns in _PNews.NSource)
                            {
                                try
                                {
                                    OnLog(LogMessageType.Event, ns.Title);
                                    //
                                    LoadNewsRSS(sqlCmmndNews, sqlCmmndEncl, ns);
                                    //
                                    OnLog(LogMessageType.Event, _PNews.WSaitID.ToString() + _Msg3_NewsChargedHandle);
                                    TmpNewsRepair(sqlCmmndNews);
                                    //
                                    OnLog(LogMessageType.Event, _PNews.WSaitID.ToString() + _Msg4_LoadingNews);
                                    TmpNewsTransfer(sqlCmmndNews, sqlCmmndEncl);
                                    //
                                    OnLog(LogMessageType.Event, _PNews.WSaitID.ToString() + _Msg5_Done);
                                }
                                catch (Exception ex)
                                {
                                    OnLog(LogMessageType.Error, "Exception /Load:" + ns.URL + "/: " + ex.Message);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                OnLog(LogMessageType.Error, "Exception: " + ex.Message);
            }
        }
开发者ID:DMSys,项目名称:DotNetUtility,代码行数:47,代码来源:ENews.cs

示例15: ExecuteNonQuery

        //////////////////////////////////////////////////////////////
        //
        // All non queries are funneled through one connection
        // to increase performance a little
        //
        protected int ExecuteNonQuery(SqliteCommand cmd, SqliteConnection connection)
        {
            lock (connection)
            {
/*
                SqliteConnection newConnection =
                        (SqliteConnection)((ICloneable)connection).Clone();
                newConnection.Open();

                cmd.Connection = newConnection;
*/
                cmd.Connection = connection;
                //Console.WriteLine("XXX " + cmd.CommandText);

                return cmd.ExecuteNonQuery();
            }
        }
开发者ID:BackupTheBerlios,项目名称:seleon,代码行数:22,代码来源:SQLiteFramework.cs


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