Exemple #1
0
        public bool insertData(mrate k)
        {
            bool stat = false;

            try
            {
                Connection ConnG = new Connection();
                ConnG.Konek();
                strQuery             = new MySql.Data.MySqlClient.MySqlCommand();
                strQuery.Connection  = ConnG.Conn;
                strQuery.CommandType = CommandType.Text;
                strQuery.CommandText = "INSERT INTO tblmrate(DATE,CURRENCYID,KURS) VALUES(@Date,@CurrencyID,@Kurs)";
                strQuery.Parameters.AddWithValue("@Date", k.DATE);
                strQuery.Parameters.AddWithValue("@CurrencyID", k.CURRENCYID);
                strQuery.Parameters.AddWithValue("@Kurs", k.KURS);
                strQuery.ExecuteNonQuery();
                stat = true;
                ConnG.Putus();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            return(stat);
        }
Exemple #2
0
        public bool updateData(mrate k)
        {
            bool stat = false;

            try
            {
                Connection ConnG = new Connection();
                ConnG.Konek();
                strQuery             = new MySql.Data.MySqlClient.MySqlCommand();
                strQuery.Connection  = ConnG.Conn;
                strQuery.CommandType = CommandType.Text;
                strQuery.CommandText = "UPDATE tblmrate SET DATE=@Date,CURRENCYID=@CurrencyID,KURS=@Kurs WHERE ID=@ID";
                strQuery.Parameters.AddWithValue("@ID", k.ID);
                strQuery.Parameters.AddWithValue("@CurrencyID", k.CURRENCYID);
                strQuery.Parameters.AddWithValue("@Date", k.DATE);
                strQuery.Parameters.AddWithValue("@Kurs", k.KURS);
                strQuery.ExecuteNonQuery();
                ConnG.Putus();
                stat = true;
            }
            catch
            {
            }
            return(stat);
        }