コード例 #1
0
        public bool updateData(eximbcdetail k, string DOCTYPE1, string JENIS1,string IDDetail1)
        {
            bool stat = false;
            try
            {
                Connection ConnG = new Connection();
                ConnG.Konek();
                strQuery = new MySqlCommand();
                strQuery.Connection = ConnG.Conn;
                strQuery.CommandType = CommandType.Text;
                strQuery.CommandText = "UPDATE tbleximbcdetail SET DOCTYPE=@DOCTYPE,JENIS=@JENIS,IDDetail=@IDDetail" +
                                       " WHERE DOCTYPE=@DOCTYPE1 AND JENIS=@JENIS1 AND IDDetail=@IDDetail1";
                //key
                strQuery.Parameters.AddWithValue("@DOCTYPE1", DOCTYPE1);
                strQuery.Parameters.AddWithValue("@JENIS1", JENIS1);
                strQuery.Parameters.AddWithValue("@IDDetail1", IDDetail1);
                //en key
                strQuery.Parameters.AddWithValue("@DOCTYPE", k.DOCTYPE);
                strQuery.Parameters.AddWithValue("@JENIS", k.JENIS);
                strQuery.Parameters.AddWithValue("@IDDetail", k.IDDetail);
                strQuery.ExecuteNonQuery();

                ConnG.Putus();
                stat = true;

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            return stat;
        }
コード例 #2
0
        public bool insertData(eximbcdetail 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 tbleximbcdetail (DOCTYPE,JENIS,IDDetail) " +
                    "VALUES (@DOCTYPE,@JENIS,@IDDetail)";
                strQuery.Parameters.AddWithValue("@DOCTYPE", k.DOCTYPE);
                strQuery.Parameters.AddWithValue("@JENIS", k.JENIS);
                strQuery.Parameters.AddWithValue("@IDDetail", k.IDDetail);
                strQuery.ExecuteNonQuery();
                stat = true;
                ConnG.Putus();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            return stat;
        }