コード例 #1
0
        public void ImportToDB2()
        {
            List <string> FRLots = new List <string>();
            DB2Helper     db2    = new DB2Helper();
            string        sql    = string.Format("select lot_id from mmview.frlot where lot_id in ('{0}')", FormatLotIDCondition);

            db2.GetSomeData(sql);
            foreach (DataRow dr in db2.dt.Rows)
            {
                FRLots.Add(dr[0].ToString());
            }
            foreach (string lot in LotID)
            {
                if (!FRLots.Contains(lot))
                {
                    ErrorID.Add(lot);
                }
            }
            LotID = FRLots;
            if (Mode == "OverRide")
            {
                sql = string.Format("insert into ISTRPT.RPT_WIP_SPECIAL_LOT (LOT_ID) values ('{0}')", FormatLotIDCondition2);
                sql = string.Format("delete from ISTRPT.RPT_WIP_SPECIAL_LOT;{0}", sql);
                db2.GetSomeData(sql);
            }
            else if (Mode == "AddMore")
            {
                foreach (string lot in LotID)
                {
                    try
                    {
                        sql = string.Format("insert into ISTRPT.RPT_WIP_SPECIAL_LOT (LOT_ID) values ('{0}')", lot);
                        db2.GetSomeData(sql);
                    }
                    catch (Exception)
                    {
                        RepeatID.Add(lot);
                    }
                }
            }
        }