SQlite Login Form Csharp

using Finisar.SQLite;

private void SetConnection()

{

sql_con = new SQLiteConnection("Data Source=test.db;Version=3;New=False;Compress=false;"); 

}
              private void ExecuteQuery(string txtQuery)

        {
            SetConnection();
            sql_con.Open();
            sql_cmd = sql_con.CreateCommand();

            sql_cmd.CommandText = txtQuery;
            sql_cmd.ExecuteNonQuery();

            sql_con.Close();

        }


                 private void LogInBtn(object sender, EventArgs e)
      
       {

           string query = "select from  (UserInfo) where Password='" + textBox1.Text + "'";
            ExecuteQuery(query);
            SQLiteDataReader dr = sql_cmd.ExecuteReader();
            int count = 0;
            string password = "";

while (dr.Read())
            {

                 count++;

            }

            if (count == 1)

            {

               MessageBox.Show("Logged In ");
           }

            else

                          MessageBox.Show("Wrong Password");

      }
    }
}

No comments:

Post a Comment

Sending SMS Via Windows Form Application Using any Android Smart Phone  Source Code  using System ; using System . C...