Exemple #1
0
 public long  Get(string seqName  )
 {
     int total = 1;
     DataHelper hp = new DataHelper(connString, providerName);
     DbParameter[] pars = new DbParameter[4];
     DbParameter startPar, endPar;
     pars[0] = DataHelper.CreateParameter(providerName, "SeqName", seqName);
     pars[1] = DataHelper.CreateParameter(providerName, "SeqNum", total);
     startPar = DataHelper.CreateParameter(providerName, "SeqStart", DbType.Int64, ParameterDirection.Output);
     endPar = DataHelper.CreateParameter(providerName, "SeqEnd", DbType.Int64, ParameterDirection.Output);
     pars[2] = startPar;
     pars[3] = endPar;
     hp.ExecuteNonQuery(getSeqSp, System.Data.CommandType.StoredProcedure, pars);
     long start = (long)startPar.Value;
     long end = (long)endPar.Value;
     //Log.Write(LogAction.Write, seqName + ":" + start + " " + end);
     if (end - start == total - 1)
         return  end;
     string msg = "多取" + seqName + "返回异常,返回数量和指定数量不合:total=" + total + " start=" + start + " end=" + end;
     Log.Error(msg);
     throw new DataException(msg);
 }
Exemple #2
0
 public int ExecuteNonQuery(string cmdText, CommandType cmdType, params DbParameter[] parameters)
 {
     DataHelper hp = new DataHelper(_connString, _providerName);
     int rtn = hp.ExecuteNonQuery(cmdText, cmdType, parameters);
     return rtn;
 }