コード例 #1
0
        public string get_password(string userid)
        {
            MySqlConnection connection = Cl_MySQL.getMySQLConnection();

            Cl_MySQL.OpenMySQLConnection(connection);

            MySqlParameter param = new MySqlParameter();

            param.ParameterName = "@userid";
            param.Value         = userid;

            MySqlCommand command = connection.CreateCommand();

            command.CommandText = "SELECT Passwordtext FROM password WHERE UID = @userid  ";
            command.Parameters.Add(param);

            MySqlDataReader reader;

            reader = command.ExecuteReader();

            while (reader.Read())
            {
                this.password = reader.GetValue(0).ToString();
            }

            Cl_MySQL.CloseMySQLConnection(connection);


            return(this.password);
        }
コード例 #2
0
ファイル: Testformular.cs プロジェクト: jonsy92/fitraspi
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         Cl_MySQL.CloseMySQLConnection(connection);
         MessageBox.Show("You are disconnected from the database!");
     }
     catch
     {
         MessageBox.Show("No database-connection exists!");
     }
 }