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


C# SQLiteConnection.ChangePassword方法代码示例

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


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

示例1: Main

        static void Main(string[] args)
        {
            string databaseFile = "border_tile_pattern.sqlite";
            string currentPassword = "";
            string newPassword = "mootoo-meepo-wergweguowh2rg134243terbdssdff";

            string currentDir = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
            currentDir = currentDir.Replace("file:\\", "");

            string connString = "Data Source=" + currentDir + "/"+databaseFile+";Pooling=True";

            if (currentPassword != "") connString += ";Password="+currentPassword;

            SQLiteConnection conn = new SQLiteConnection(connString);
            conn.Open();

            Console.WriteLine("Changing password ... ");
            if (newPassword == "")
                conn.ChangePassword(new byte[0]);
            else
                conn.ChangePassword(newPassword);

            Console.WriteLine("Done !");
            Console.ReadLine();
        }
开发者ID:mootoomeepo,项目名称:mootoo.meepo,代码行数:25,代码来源:Program.cs

示例2: sqlconnect

        public sqlconnect(string data, string password)
        {
            if (!File.Exists(data))
            {
                SQLiteConnection.CreateFile(data);
                try
                {
                    m_dbConnection = new SQLiteConnection("Data Source=" + data + ";Version=3;");
                    m_dbConnection.Open();
                    m_dbConnection.ChangePassword(password);
                }
                catch(SQLiteException ex)
                {
                    Debug.WriteLine(ex.Message);

                }
            }
            else
            {
                try
                {
                    m_dbConnection = new SQLiteConnection("Data Source=" + data + "; Password=" + password);
                    m_dbConnection.Open();
                }
                catch (SQLiteException ex)
                {
                    Debug.WriteLine(ex.Message);

                }
            }
            //string sql = "SELECT name FROM sqlite_master WHERE type='table' AND name='table_name'";
            string[] sqls = new string[]{
            "CREATE TABLE IF NOT EXISTS UrlListTmp(id INTEGER PRIMARY KEY,Url TEXT UNIQUE,Valid INT DEFAULT 0)",
            "CREATE TABLE IF NOT EXISTS ProxyListTmp(id INTEGER PRIMARY KEY,Ipport TEXT UNIQUE,Valid INT DEFAULT 0,Https INT DEFAULT 0,Google INT DEFAULT 0,Speed INT DEFAULT 0,Typeprox INT DEFAULT 0)",
            "CREATE TABLE IF NOT EXISTS UrlList(id INTEGER PRIMARY KEY,Url TEXT UNIQUE,Valid INT DEFAULT 0)",
            "CREATE TABLE IF NOT EXISTS ProxyList(id INTEGER PRIMARY KEY,Ipport TEXT UNIQUE,Valid INT DEFAULT 0,Https INT DEFAULT 0,Google INT DEFAULT 0,Speed INT DEFAULT 0,Typeprox INT DEFAULT 0)",
            "CREATE TABLE IF NOT EXISTS ProxyListFilter(id INTEGER PRIMARY KEY,Ipport TEXT UNIQUE,Valid INT DEFAULT 0,Https INT DEFAULT 0,Google INT DEFAULT 0,Speed INT DEFAULT 0,Typeprox INT DEFAULT 0)"

            //"CREATE INDEX UrlList_idx_1 on UrlList (url)",
            //"CREATE INDEX ProxyList_idx_1 on ProxyList (ipport)"

            };

            foreach (string sql in sqls)
            {

                try
                {
                    SQLiteCommand command = new SQLiteCommand(sql, m_dbConnection);
                    command.ExecuteNonQuery();
                }
                catch (SQLiteException ex)
                {
                    Debug.WriteLine(ex.Message);

                }

            }
        }
开发者ID:cripperz,项目名称:proxyscrape,代码行数:59,代码来源:sqlconnect.cs

示例3: EncryptDb

 public void EncryptDb(byte[] password)
 {
     var connectionString = string.Format("Data Source={0}", this.DatabasePath);
     var connection = new SQLiteConnection(connectionString);
     connection.Open();
     connection.ChangePassword(password);
     connection.Close();
 }
开发者ID:B2MSolutions,项目名称:reyna-net45,代码行数:8,代码来源:EncryptionChecker.cs

示例4: EncryptDatabase

 public static void EncryptDatabase(string dbPath, string password)
 {
     SQLiteConnection connection = new SQLiteConnection("Data Source=" + dbPath);
     connection.Open();
     #if !DEBUG
     connection.ChangePassword(password);
     #endif
     connection.Close();
 }
开发者ID:rew170,项目名称:soomecode,代码行数:9,代码来源:SQLiteDBHelper.cs

示例5: Main

        static void Main(string[] args)
        {
            string dbFile = "c:/test3d.db";
            SQLiteConnection.CreateFile(dbFile);

            using (var m_dbConnection =
                new SQLiteConnection(String.Format("Data Source={0};Version=3;", dbFile)))
            {

                m_dbConnection.Open();
                m_dbConnection.ChangePassword("Mypass");

                Action<string> funcSqlStr = delegate(string x)
                {
                    string sqlStr = x;
                    var commandDel = new SQLiteCommand(sqlStr, m_dbConnection);
                    commandDel.ExecuteNonQuery();
                    commandDel.Dispose();
                };

                string sql = "create table highscores (name varchar(20), score int)";
                funcSqlStr(sql);

                sql = "insert into highscores (name, score) values ('Me', 3000)";
                funcSqlStr(sql);

                sql = "insert into highscores (name, score) values ('Myself', 6000)";
                funcSqlStr(sql);

                sql = "insert into highscores (name, score) values ('And I', 9001)";
                funcSqlStr(sql);

                sql = "select * from highscores order by score desc";
                var command = new SQLiteCommand(sql, m_dbConnection);

                var reader = command.ExecuteReader();
                while (reader.Read())
                    Console.WriteLine("Name: " + reader["name"] + "\tScore: " + reader["score"]);
                reader.Dispose();

            }

            Console.ReadKey();
        }
开发者ID:fwswdev,项目名称:CSharpSqliteDemo,代码行数:44,代码来源:Program.cs

示例6: SetPwd

 private static void SetPwd(string oldpwd,string newpwd)
 {
     using (SQLiteConnection conn = new SQLiteConnection(@"data source=F:\github\DFZ\source\DFZ.BenSeLing\App_Data\benseling.db"))
     {
         conn.SetPassword(oldpwd);
         conn.Open();
         conn.ChangePassword(newpwd);
         conn.Close();
     }
 }
开发者ID:zhuqibiao,项目名称:DFZ,代码行数:10,代码来源:Program.cs

示例7: CreateDB

 public static void CreateDB(string dbPath, string pwd = "")
 {
     SQLiteConnection.CreateFile(dbPath);
     using (SQLiteConnection cnn = new SQLiteConnection("Data Source=" + dbPath))
     {
         cnn.Open();
         if (!string.IsNullOrEmpty(pwd))
         {
             cnn.ChangePassword(pwd);
         }
     }
 }
开发者ID:Makk24,项目名称:GetHtmlPage,代码行数:12,代码来源:Sqlitehelper.cs

示例8: ChangePassword

 public bool ChangePassword(string newpsd)
 {
     try
     {
         using (SQLiteConnection connection = new SQLiteConnection(connectionString))
         {
             connection.Open();
             connection.ChangePassword(newpsd);
             connection.Close();
             return true;
         }
     }
     catch
     {
         return false;
     }
 }
开发者ID:JimmyFung,项目名称:DesktopHelper,代码行数:17,代码来源:SqlLiteDBHelper.cs

示例9: ChangePassword

 public static bool ChangePassword(string newPassword, string oldPassword = "")
 {
     if (oldPassword == conStr.Password)
     {
         using (SQLiteConnection conn = new SQLiteConnection(conStr.ConnectionString))
         {
             conn.Open();
             conn.ChangePassword(newPassword);
             conn.Close();
         }
         return true;
     }
     else
     {
         return false;
     }
 }
开发者ID:QingWei-Li,项目名称:MyLife,代码行数:17,代码来源:SQLiteHelper.cs

示例10: SetPasswrod

        public bool SetPasswrod(String dbfile, String currentpass, String newpassword)
        {
            bool retval = false;

            //String connStr = String.Format("Data Source={0};Version=3;New=False;Compress=True;Password={1};", dbfile, password);
            String connStr = String.Format("Data Source={0};Version=3;New=False;Compress=True;",
                dbfile);

            if (!String.IsNullOrEmpty(currentpass))
                connStr = String.Format("Data Source={0};Version=3;New=False;Compress=True;Password={1};",
                    dbfile, currentpass);

            try
            {
                using (var cnn = new SQLiteConnection(connStr))
                {
                    cnn.Open();
                    cnn.ChangePassword(newpassword);
                    //cnn.ChangePassword("");

                    String sql = "SELECT count(*) FROM sqlite_master WHERE type='table'";
                    using (SQLiteCommand myCommand = new SQLiteCommand(sql, cnn))
                    {
                        var a = myCommand.ExecuteScalar();
                        Console.WriteLine("Total : " + a.ToString() + " tables found!");
                    }

                    retval = true;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                // throw e;
            }

            return retval;
        }
开发者ID:nikson,项目名称:FastORM,代码行数:38,代码来源:SqliteDbUtil.cs

示例11: createNewDb

        /**
         * Warning: Implicitly overwrites existing file!
         */
        private void createNewDb(String name, bool overwrite)
        {
            try
            {
                if (!name.EndsWith(".reminder19"))
                    name += ".reminder19";

                if (File.Exists(name) && overwrite)
                {
                    File.Delete(name);
                }
                else if (File.Exists(name) && !overwrite)
                {
                    throw new Exception("Database already exists.");
                }

                SQLiteConnection.CreateFile(name);
                conn = new SQLiteConnection("Data Source=" + name);
                conn.Open();
                conn.ChangePassword("reminder19!!!");

                //Create the tables
                SQLiteCommand cmd = conn.CreateCommand();
                cmd.CommandText = createAlertsTable;
                cmd.ExecuteNonQuery();
                cmd.Dispose();

                initSettingsTable();
            }
            catch (Exception)
            {
                MsgBox.Show(true, "Failed to create database!  Please make sure the Reminder 19 directory can be written to!",
                    "Fatal Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Environment.Exit(1);
            }
        }
开发者ID:jdiscar,项目名称:reminder19,代码行数:39,代码来源:Controller.cs

示例12: InitSystemDB

        private static void InitSystemDB(string systemDB)
        {
            Trace.TraceInformation ("Creating storage folder...");
            if (!Directory.Exists (BaseSystem.GetSystemDBBaseLocation ())) {
                Directory.CreateDirectory (BaseSystem.GetSystemDBBaseLocation ());
            }

            Trace.TraceInformation ("Creating system db...");
            SQLiteConnection cnn = new SQLiteConnection (SYSTEMDB_CONN_STR_FOR_WRITING);

            Debug.Print ("New connection created. Opening connection for system db...");
            cnn.Open ();

            Debug.Print ("Changing password.");
            cnn.ChangePassword (BaseSystem.GetSystemDBPassword ());

            string sql = SystemSchema.GetSystemSchema ();
            Debug.Print ("Adding system db table schema: " + sql);

            SQLiteCommand myCommand = new SQLiteCommand (sql, cnn);
            myCommand.ExecuteNonQuery ();
            Trace.TraceInformation ("Done creating system db!");

            cnn.Dispose ();
            Debug.Print ("Closed connection for creating system db.");
        }
开发者ID:cryptonome,项目名称:mnemonicfs,代码行数:26,代码来源:MfsDBOperations.cs

示例13: ChangePassword

 internal void ChangePassword(string passwd)
 {
     using (SQLiteConnection conn = new SQLiteConnection(_db_connstring_builder.ToString()))
     {
         conn.Open();
         conn.ChangePassword(passwd);                
         _db_connstring_builder.Password = passwd;
     }
 }
开发者ID:mramthun,项目名称:pbank,代码行数:9,代码来源:Database.cs

示例14: SendEncryptedQuery

 public static bool SendEncryptedQuery(string db, string cmd)
 {
     bool success = false;
     using (SQLiteConnection sql_con = new SQLiteConnection(db))
     {
         try
         {
             sql_con.Open();
             sql_con.ChangePassword("Jawad");
         }
         catch (Exception es)
         {
             SystemLogs_DB.Add(DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss") + "Failed to open database connection,Error: " + es);
         }
         if (sql_con.State == ConnectionState.Open)
         {
             Connected = true;
         }
         else
         {
             Connected = false;
         }
         if (Connected)
         {
             try
             {
                 SQLiteCommand sql_cmd = sql_con.CreateCommand();
                 sql_cmd.CommandText = cmd;
                 sql_cmd.ExecuteNonQuery();
                 success = true;
             }
             catch (Exception es)
             {
                 SystemLogs_DB.Add(DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss") + "Failed to send query,Error: " + es);
             }
         }
     }
     return success;
 }
开发者ID:jkhan1992,项目名称:LCA,代码行数:39,代码来源:Database_Functions.cs

示例15: SQLDatabaseInitilize

        //private static SQLiteDataReader sqReader;
        //private static SQLiteParameter fileParameter; //Parameterized Query
        // Creates the three tables: scanned, unScanned, and unScannable
        public static void SQLDatabaseInitilize()
        {
            String dbName = Environment.UserName+"@"+Environment.MachineName+"_"+System.DateTime.Now.ToString("MM_dd_yy_H_mm_ss");
            //MessageBox.Show(dbName);
            try
            {
               //if (File.Exists(".db"))
                    //File.Delete("db.db");
                sqlCon = new SQLiteConnection("Data Source="+dbName+".sdb;Version=3;New=True;Compress=True;"); //create a new database
                sqlCon.Open(); //open the connection
                String []password = dbName.Split('@');
                String[] dbPassword = password[1].Split('_');
                sqlCon.ChangePassword(password[0] + dbPassword[0]);

                sqlCmd = sqlCon.CreateCommand();
                // Create scanned table
                sqlCmd.CommandText = "CREATE TABLE if not exists Scanned (fileIndex integer PRIMARY KEY AUTOINCREMENT, filename text, " +
                                     "filePath text, count integer, priority text, pattern_D9_Count integer, pattern_D324_Count integer);";
                sqlCmd.ExecuteNonQuery();
                // Create unScannable table
                sqlCmd.CommandText = "CREATE TABLE if not exists UnScannable (filename text, filePath text, owner text, reason text);";
                sqlCmd.ExecuteNonQuery();
                // Create CreditCard table
                sqlCmd.CommandText = "CREATE TABLE if not exists CreditCard (filename text, filePath text, count integer, priority text, " +
                                     "visa integer, mastercard integer, americanExpress integer, discover integer, dinerClub integer, JCB integer);";
                sqlCmd.ExecuteNonQuery();
                //Create CrashStatus table
                sqlCmd.CommandText = "CREATE TABLE if not exists CrashStatus (status text);";
                sqlCmd.ExecuteNonQuery();
            }
            catch (Exception) { /*MessageBox.Show(e.ToString());*/ }
        }
开发者ID:mtotheikle,项目名称:EWU-OIT-SSN-Scanner,代码行数:35,代码来源:Database.cs


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