Esempio n. 1
0
        private static List <V_INOUTSTOCK> DoQuery(string sql_str)
        {
            List <V_INOUTSTOCK> rtn = new List <V_INOUTSTOCK>();
            DBHelper_Sqlserver  DBHelper_Sqlserver = new DBHelper_Sqlserver();

            try
            {
                using (IDataReader dr = DBHelper_Sqlserver.ExecuteReader(sql_str))
                {
                    while (dr.Read())
                    {
                        var p = new V_INOUTSTOCK();
                        #region 逐个赋值
                        p.WAREHOUSENO       = DBHelper_Sqlserver.GetDataValue <string>(dr, "WAREHOUSENO");
                        p.CONTAINERNO       = DBHelper_Sqlserver.GetDataValue <string>(dr, "CONTAINERNO");
                        p.TASKTYPE          = DBHelper_Sqlserver.GetDataValue <string>(dr, "TASKTYPE");
                        p.SOURCEPLACE       = DBHelper_Sqlserver.GetDataValue <string>(dr, "SOURCEPLACE");
                        p.TOPLACE           = DBHelper_Sqlserver.GetDataValue <string>(dr, "TOPLACE");
                        p.UPDATEUSER        = DBHelper_Sqlserver.GetDataValue <string>(dr, "UPDATEUSER");
                        p.UPDATETIME        = DBHelper_Sqlserver.GetDataValue <string>(dr, "UPDATETIME");
                        p.TASKCONTENTSTRING = DBHelper_Sqlserver.GetDataValue <string>(dr, "TASKCONTENTSTRING");

                        #endregion
                        rtn.Add(p);
                    }
                }
            }
            catch
            {
            }
            return(rtn);
        }
Esempio n. 2
0
        /// <summary>
        /// 路桥的数据库备份
        /// </summary>
        /// <param name="bkFileName"></param>
        /// <returns></returns>
        public static bool BackUpForDB(string bkFileName)
        {
            if (System.IO.File.Exists(bkFileName))
            {
                System.IO.File.Delete(bkFileName);
            }
            string             sqltxt = @"BACKUP DATABASE [ASRS_VOLVO] TO Disk='" + bkFileName + "'";
            DBHelper_Sqlserver dbh    = new DBHelper_Sqlserver();
            int val = dbh.ExecuteNonQuery(sqltxt);

            if (val > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }