Пример #1
0
 public DataSet ExecuteDataSet(WrapedDatabaseParameter parms)
 {
     long t = DateTime.Now.Ticks;
     try
     {
         DatabaseParameter[] pars = parms.DatabaseParameters ?? new DatabaseParameter[] { };
         DbParameter[] ps = ConvertParameter(pars);
         DAC dac = new DAC(parms.RoutingKey, parms.ConnectionString);
         DataSet ds = dac.ExecuteDataSet(parms.TableName ?? "DataSet", parms.CmdText, (CommandType)parms.CmdType, ps);
         Log.Write(LogAction.Svc, className, "ExecuteDataSetWraped", parms.ConnectionString, parms.CmdText.TrimSql(128), DateTime.Now.Ticks - t, "执行成功:" + (CommandType)parms.CmdType + " " + pars.ToKeyString());
         return ds;
     }
     catch (Exception e)
     {
         Log.Write(LogAction.Error, className, "ExecuteDataSetWraped", parms.ConnectionString, parms.CmdText.TrimSql(128), DateTime.Now.Ticks - t, "执行出错:" + (CommandType)parms.CmdType + " " + parms + ";" + e.ToString());
     }
     return new DataSet();
 }
Пример #2
0
 public DataSet ExecutePagedDataSet(string connString, string dsTableName, string tableName, string fields, string orderBy, long pageIndex, long pageSize, long recordCount, string where)
 {
     long t = DateTime.Now.Ticks;
     try
     {
         DAC dac = new DAC(connString);
         List<DbParameter> pars = new List<DbParameter>();
         pars.Add(dac.CreateParameter("TableName", tableName));
         pars.Add(dac.CreateParameter("Fields", fields));
         pars.Add(dac.CreateParameter("OrderBy", orderBy));
         pars.Add(dac.CreateParameter("PageIndex", pageIndex));
         pars.Add(dac.CreateParameter("PageSize", pageSize));
         pars.Add(dac.CreateParameter("RecordCount", recordCount));
         pars.Add(dac.CreateParameter("Where", where));
         DataSet ds = dac.ExecuteDataSet(tableName, "PagedRecordSP", CommandType.StoredProcedure, pars.ToArray());
         Log.Write(LogAction.Dac, className, "ExecutePagedDataSet", connString, "PagedRecordSP", DateTime.Now.Ticks - t, "执行成功");
         return ds;
     }
     catch (Exception e)
     {
         Log.Write(LogAction.Error, className, "ExecutePagedDataSet", connString, "PagedRecordSP", DateTime.Now.Ticks - t, "执行出错:cmdText:PagedRecordSP;" + e.Message);
     }
     return new DataSet();
 }
Пример #3
0
 public DataSet ExecutePagedDataSet(PagedRecordParameter prp)
 {
     long t = DateTime.Now.Ticks;
     try
     {
         DAC dac = new DAC(prp.ConnectionString);
         List<DbParameter> pars = new List<DbParameter>();
         pars.Add(dac.CreateParameter("TableName", prp.TableName));
         pars.Add(dac.CreateParameter("Fields", prp.Fields));
         pars.Add(dac.CreateParameter("OrderBy", prp.OrderBy));
         pars.Add(dac.CreateParameter("PageIndex", prp.PageIndex));
         pars.Add(dac.CreateParameter("PageSize", prp.PageSize));
         pars.Add(dac.CreateParameter("RecordCount", prp.RecordCount));
         pars.Add(dac.CreateParameter("Where", prp.Where));
         DataSet ds = dac.ExecuteDataSet(prp.DSTableName, "PagedRecordSP", CommandType.StoredProcedure, pars.ToArray());
         Log.Write(LogAction.Dac, className, "ExecutePagedDataSetWraped", prp.ConnectionString, "PagedRecordSP", DateTime.Now.Ticks - t, "执行成功");
         return ds;
     }
     catch (Exception e)
     {
         Log.Write(LogAction.Error, className, "ExecutePagedDataSetWraped", prp.ConnectionString, "PagedRecordSP", DateTime.Now.Ticks - t, "执行出错:cmdText:PagedRecordSP;" + e.Message);
     }
     return new DataSet();
 }
Пример #4
0
 public DataSet ExecuteDataSet(string tableName, string connString, string cmdText, CommandType cmdType, params DatabaseParameter[] parameters)
 {
     long t = DateTime.Now.Ticks;
     try
     {
         DbParameter[] ps = ConvertParameter(parameters);
         DAC dac = new DAC(connString);
         DataSet ds = dac.ExecuteDataSet(tableName, cmdText, cmdType, ps);
         Log.Write(LogAction.Svc, className, "ExecuteDataSet", connString, cmdText.TrimSql(128), DateTime.Now.Ticks - t, "执行成功:" + parameters.ToKeyString());
         return ds;
     }
     catch (Exception e)
     {
         Log.Write(LogAction.Error, className, "ExecuteDataSet", connString, cmdText.TrimSql(128), DateTime.Now.Ticks - t, "执行出错:cmdText:" + cmdText + ";" + parameters.ToKeyString() + ";" + e.ToString());
     }
     return new DataSet();
 }