예제 #1
0
 private DataSet Read()
 {
     DataBaseAgent.DBOperator myDB = GetDBOperator();
     try
     {
         myDB.Open();
         myDB.BeginTrans();
         DataSet ds = myDB.ReadData(_SqlString, _SqlCommandType, _SqlStringParams, _SqlStringParamsValues);
         myDB.Close();
         return(ds);
     }
     catch (Exception exp)
     {
         //myDB.RollbackTrans();
         myDB.Close();
         WriteLog(exp.ToString(), "Read", 1, 5);
         //throw new Exception(exp.Message);
         //new Logs.LogManage().WriteLogs(exp.Message);//日志模块还没有完成
         return(new DataSet());
     }
 }
예제 #2
0
        private int Write()
        {
            DataBaseAgent.DBOperator myDB = GetDBOperator();

            try
            {
                myDB.Open();
                myDB.BeginTrans();
                int count = myDB.WriteData(_SqlString, _SqlCommandType, _SqlStringParams, _SqlStringParamsValues);
                myDB.CommitTrans();
                myDB.Close();
                return(count);
            }
            catch (Exception exp)
            {
                //myDB.RollbackTrans();
                myDB.Close();
                WriteLog(exp.ToString(), "Write", 1, 5);
                //throw new Exception(exp.Message);
                //new Logs.LogManage().WriteLogs(exp.Message);//日志模块还没有完成
                return(0);
            }
        }