Пример #1
0
 public DataTable SelectDT(string sql)
 {
     try
     {
         List <GJ> gjs = new List <GJ>();
         DataSet   ds  = DbHelper.Query(sql);
         return(ds.Tables[0]);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Пример #2
0
 public List <GJ> Select(string sql)
 {
     try
     {
         List <GJ> gjs = new List <GJ>();
         DataSet   ds  = DbHelper.Query(sql);
         foreach (DataRow dr in ds.Tables[0].Rows)
         {
             gjs.Add(LoadEntity(dr));
         }
         return(gjs);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Пример #3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.TimerMission GetModel(Guid id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 id,MissionName,GroupName,SqlStr,TimeCorn,RepeatCount,InveralTime,StartTime,EndTime,CreateTime,MissionExplain,MissionState,IsDel from TimerMission ");
            strSql.Append(" where id=@id ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.UniqueIdentifier, 16)
            };
            parameters[0].Value = id;

            Model.TimerMission model = new Model.TimerMission();
            DataSet            ds    = DbHelper.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }