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

            try
            {
                Connection ConnG = new Connection();
                ConnG.Konek();
                strQuery             = new MySqlCommand();
                strQuery.Connection  = ConnG.Conn;
                strQuery.CommandType = CommandType.Text;

                strQuery.CommandText = "INSERT INTO tbleximbc (DOCTYPE,JENIS,DESCRIPTION) " +
                                       "VALUES (@DOCTYPE,@JENIS,@DESCRIPTION)";
                strQuery.Parameters.AddWithValue("@DOCTYPE", k.DOCTYPE);
                strQuery.Parameters.AddWithValue("@JENIS", k.JENIS);
                strQuery.Parameters.AddWithValue("@DESCRIPTION", k.DESCRIPTION);
                strQuery.ExecuteNonQuery();
                stat = true;
                ConnG.Putus();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            return(stat);
        }
Exemple #2
0
        public bool updateData(eximbc k, string DOCTYPE1, string JENIS1)
        {
            bool stat = false;

            try
            {
                Connection ConnG = new Connection();
                ConnG.Konek();
                strQuery             = new MySqlCommand();
                strQuery.Connection  = ConnG.Conn;
                strQuery.CommandType = CommandType.Text;
                strQuery.CommandText = "UPDATE tbleximbc SET DOCTYPE=@DOCTYPE,JENIS=@JENIS,DESCRIPTION=@DESCRIPTION" +
                                       " WHERE DOCTYPE=@DOCTYPE1 AND JENIS=@JENIS1";
                //key
                strQuery.Parameters.AddWithValue("@DOCTYPE1", DOCTYPE1);
                strQuery.Parameters.AddWithValue("@JENIS1", JENIS1);
                //en key
                strQuery.Parameters.AddWithValue("@DOCTYPE", k.DOCTYPE);
                strQuery.Parameters.AddWithValue("@JENIS", k.JENIS);
                strQuery.Parameters.AddWithValue("@DESCRIPTION", k.DESCRIPTION);
                strQuery.ExecuteNonQuery();

                ConnG.Putus();
                stat = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            return(stat);
        }