Esempio n. 1
0
        public bool updateData(cuttdetail k, string CUTNO1, string SIZEID1)
        {
            bool stat = false;

            try
            {
                Connection ConnG = new Connection();
                ConnG.Konek();
                strQuery             = new MySqlCommand();
                strQuery.Connection  = ConnG.Conn;
                strQuery.CommandType = CommandType.Text;
                strQuery.CommandText = "UPDATE tblcuttdetail SET CUTNO=@CUTNO,SIZEID=@SIZEID,QTY=@QTY" +
                                       " WHERE  CUTNO=@CUTNO1 AND SIZEID=@SIZEID1 ";
                //key
                strQuery.Parameters.AddWithValue("@CUTNO1", CUTNO1);
                strQuery.Parameters.AddWithValue("@SIZEID1", SIZEID1);

                //
                strQuery.Parameters.AddWithValue("@CUTNO", k.CUTNO);
                strQuery.Parameters.AddWithValue("@SIZEID", k.SIZEID);
                strQuery.Parameters.AddWithValue("@QTY", k.QTY);

                strQuery.ExecuteNonQuery();
                ConnG.Putus();
                stat = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            return(stat);
        }
Esempio n. 2
0
        public bool insertData(cuttdetail 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 tblcuttdetail(CUTNO,SIZEID,QTY) " +
                                       "VALUES(@CUTNO,@SIZEID,@QTY)";
                strQuery.Parameters.AddWithValue("@CUTNO", k.CUTNO);
                strQuery.Parameters.AddWithValue("@SIZEID", k.SIZEID);
                strQuery.Parameters.AddWithValue("@QTY", k.QTY);


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