Esempio n. 1
0
 public int ExecuteNonQuery(params WrapedDatabaseParameter[] parmss)
 {
     long t = DateTime.Now.Ticks;
     int n = 0;
     foreach (WrapedDatabaseParameter parms in parmss)
     {
         try
         {
             DatabaseParameter[] pars = parms.DatabaseParameters ?? new DatabaseParameter[] { };
             DbParameter[] ps = ConvertParameter(pars);
             DAC dac = new DAC(parms.RoutingKey, parms.ConnectionString);
             n += dac.ExecuteNonQuery(parms.CmdText, (CommandType)parms.CmdType, ps);
             Log.Write(LogAction.Svc, className, "ExecuteNonQueryWraped", parms.ConnectionString, parms.CmdText.TrimSql(128), DateTime.Now.Ticks - t, "执行成功:" + pars.ToKeyString());
         } 
         catch (Exception e)
         {
             Log.Write(LogAction.Error, className, "ExecuteNonQueryWraped", parms.ConnectionString, parms.CmdText.TrimSql(128), DateTime.Now.Ticks - t, "执行出错:" + parms + ";" + e.ToString());
             return -1;
         }
     }
     return n;
 }
Esempio n. 2
0
 public int ExecuteNonQuery(string connString, string cmdText, CommandType cmdType, params DatabaseParameter[] parameters)
 {
     long t = DateTime.Now.Ticks;
     try
     {
         DbParameter[] ps = ConvertParameter(parameters);
         DAC dac = new DAC(connString);
         int rtn = dac.ExecuteNonQuery(cmdText, cmdType, ps);
         Log.Write(LogAction.Svc, className, "ExecuteNonQuery", connString, cmdText.TrimSql(128), DateTime.Now.Ticks - t, "执行成功:" + parameters.ToKeyString());
         return rtn;
     }
     catch (Exception e)
     {
         Log.Write(LogAction.Error, className, "ExecuteNonQuery", connString, cmdText.TrimSql(128), DateTime.Now.Ticks - t, "执行出错:cmdText:" + cmdText + ";" + parameters.ToKeyString() + ";" + e.ToString());
     }
     return -1;
 }