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


C# SqliteConnection.SetPassword方法代码示例

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


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

示例1: 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

示例2: SqList

      public void SqList(string databaseFile,string opinion)
      {
         try 
         {
            if (!File.Exists (databaseFile)) 
            {

               return;

            }
            //end if

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

               sqlCon.Open ();

               using (SqliteCommand sqlCom = new SqliteCommand (sqlCon)) 
               {
                  sqlCom.CommandText="SELECT * FROM Personel";

//                       if(opinion=="Z")
//                     sqlCom.CommandText = "SELECT * FROM ZSUBE";
//
//                  else if(opinion=="Y")
//                     sqlCom.CommandText = "SELECT * FROM YSUBE";
//
                  // Execute the SELECT statement and retrieve the data
                  using (SqliteDataReader dbReader = sqlCom.ExecuteReader ())
                  {
                     if (dbReader.HasRows)
                     {
                        int i;
                        // Advance through each row
                        tasks = new List<TaskX> ();
                        while (dbReader.Read ())
                        {     
                           TaskX dtask= new TaskX() {Id = Convert.ToInt16( dbReader["ID"]), 
                              Name = String.Format (Convert.ToString (dbReader["UserName"])),
                              Notes=String.Format ( Convert.ToString (dbReader["Password"])),
                              Done=false};
                           tasks.Add(dtask);
                        };
                     }
                  };
                  TableView.Source = new RootTableSource(tasks.ToArray ());
               }
               sqlCon.Close ();
            }
         } catch (Exception ex) 
         { }
      }
开发者ID:hhempel,项目名称:StoryboardTables,代码行数:54,代码来源:cryptViewList.cs

示例3: SelectData

        public void SelectData(string databaseFile)
        {
            try
             {

            if (!File.Exists (databaseFile))
            {

               this.durumGostericiT.Text = "Database file does not exis            using (SqliteConnection sqlCon = new SqliteConnection (String.Format (\"Data Source = {0}\", databaseFile))) \nt. Tap the appropriate button to create it.";
               return;

            }
            //end if

            // Connect to database
            using (SqliteConnection sqlCon = new SqliteConnection (String.Format ("Data Source = {0}", databaseFile)))

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

               using (SqliteCommand sqlCom = new SqliteCommand (sqlCon))
               {

                  sqlCom.CommandText = "SELECT * FROM Personel WHERE Password = @lastName and UserName = @username";
                  sqlCom.Parameters.Add (new SqliteParameter ("@lastName", passwordF.Text));
                  sqlCom.Parameters.Add (new SqliteParameter ("@username", usernameF.Text));

                  // Execute the SELECT statement and retrieve the data
                  using (SqliteDataReader dbReader = sqlCom.ExecuteReader ())
                  {

                     if (dbReader.HasRows)
                     {

                        // Advance through each row
                        while (dbReader.Read ())
                        {

                           durumGostericiT.Text="eşlenme sağlandı";

                           this.usernameF.Text += String.Format ("ID: {0}\n", Convert.ToString (dbReader["UserName"]));
                           this.passwordF.Text += String.Format (" : {0}\n", Convert.ToString (dbReader["Password"]));
                           this.PerformSegue("GondericiC",this);

                        }
                        //end while

                     }

                     //end if

                  }//end using dbReader

               }
               //end using sqlCom

               sqlCon.Close ();

            }
            //end using sqlCon

            //  this.durumGostericiT.Text += "Customer data retrieved.\n";

             } catch (Exception ex)
             {

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

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

示例4: InsertData

        private void InsertData(string databaseFile)
        {
            try
             {

            if (!File.Exists (databaseFile))
            {

               this.durumGostericiT.Text = "Database file does not exist. Tap the appropriate button to create it.";
               return;

            }
            //end if

            // Connect to the database

            using (SqliteConnection sqlCon = new SqliteConnection (String.Format ("Data Source = {0}", databaseFile)))
            {
               sqlCon.SetPassword("haluk");
               sqlCon.Open ();
               using (SqliteCommand sqlCom = new SqliteCommand (sqlCon))
               {

                  sqlCom.CommandText = "INSERT INTO Personel (UserName, Password) VALUES (@username, @password)";
                  sqlCom.Parameters.Add (new SqliteParameter ("@username",usernameF.Text ));
                  sqlCom.Parameters.Add (new SqliteParameter ("@password", passwordF.Text));

                  sqlCom.ExecuteNonQuery ();

               }
               //end using sqlCom

               sqlCon.Close ();

            }
            //end using sqlCon

            this.durumGostericiT.Text = "Veri Girildi.";

             } catch (Exception ex)
             {

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

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

示例5: GetConnection

 private SqliteConnection GetConnection(String databaseName, String password)
 {
     var databasePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), databaseName);
      var conn =  new SqliteConnection(String.Format("Data Source={0}", databasePath));
      conn.SetPassword(password);
      return conn;
 }
开发者ID:hhempel,项目名称:StoryboardTables,代码行数:7,代码来源:CryptX.cs

示例6: UpdateData

        private void UpdateData(string databaseFile)
        {
            try
             {

            if (!File.Exists (databaseFile))
            {

               return;

            }
            //end if

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

               sqlCon.Open ();

               if(idX.Text=="")
               {
                  using (SqliteCommand sqlCom = new SqliteCommand (sqlCon))
                  {

                     sqlCom.CommandText = "INSERT INTO Personel (UserName, Password) VALUES (@username, @password)";
                     sqlCom.Parameters.Add (new SqliteParameter ("@username",TitleText.Text ));
                     sqlCom.Parameters.Add (new SqliteParameter ("@password", NotesText.Text));

                     sqlCom.ExecuteNonQuery ();

                  }
               }
               if (idX.Text!=null)
               {
                  using (SqliteCommand sqlCom = new SqliteCommand (sqlCon))
                  {

                     sqlCom.CommandText = "UPDATE Personel SET UserName = @username , Password = @pass WHERE ID = @id";
                     sqlCom.Parameters.Add (new SqliteParameter ("@username", TitleText.Text));
                     sqlCom.Parameters.Add (new SqliteParameter ("@pass", NotesText.Text));

                     sqlCom.Parameters.Add (new SqliteParameter ("@id",currentTask.Id));

                     sqlCom.ExecuteNonQuery ();

                  }
                  //end using sqlCom

                  sqlCon.Close ();

               }
            }

            //end using sqlCon

             } catch (Exception ex)
             {

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

示例7: DeleteData

        private void DeleteData(string databaseFile)
        {
            try
             {

            if (!File.Exists (databaseFile))
            {

               return;

            }
            //end if

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

               sqlCon.Open ();

               using (SqliteCommand sqlCom = new SqliteCommand (sqlCon))
               {
                  sqlCom.CommandText = "DELETE FROM Personel WHERE ID = @id";
                  sqlCom.Parameters.Add (new SqliteParameter ("@id",currentTask.Id));

                  sqlCom.ExecuteNonQuery ();

               }
               //end using sqlCom

               sqlCon.Close ();

            }
            //end using sqlCon

            new UIAlertView("silindi","tamam",null,"OK",null);
             } catch (Exception ex)
             {

            new UIAlertView("hata",ex.Message,null,"OK",null);

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

示例8: CreateData

        private void CreateData(string databaseFile)
        {
            try
             {
            if (!File.Exists (databaseFile))
            {
               return;
            }
            using (SqliteConnection sqlCon = new SqliteConnection (String.Format ("Data Source = {0}", databaseFile)))
            {
               sqlCon.SetPassword("haluk");

               sqlCon.Open ();

               using (SqliteCommand sqlCom = new SqliteCommand (sqlCon))
               {
                  sqlCom.CommandText = "INSERT INTO Personel (UserName, Password) VALUES (@username, @password)";
                  sqlCom.Parameters.Add (new SqliteParameter ("@username",TitleText.Text ));
                  sqlCom.Parameters.Add (new SqliteParameter ("@password", NotesText.Text));
                  sqlCom.ExecuteNonQuery ();
               }
               sqlCon.Close ();

            }

             } catch (Exception ex)
             { }
        }
开发者ID:hhempel,项目名称:StoryboardTables,代码行数:28,代码来源:SubeVerileriTaskControllerList.cs


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