예제 #1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public HD.PWManage.Model.Config DataRowToModel(DataRow row)
 {
     HD.PWManage.Model.Config model = new HD.PWManage.Model.Config();
     if (row != null)
     {
         if (row["ID"] != null && row["ID"].ToString() != "")
         {
             model.ID = int.Parse(row["ID"].ToString());
         }
         if (row["CName"] != null)
         {
             model.CName = row["CName"].ToString();
         }
         if (row["CInfo"] != null)
         {
             model.CInfo = row["CInfo"].ToString();
         }
     }
     return model;
 }
예제 #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public HD.PWManage.Model.Config GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select ID,CName,CInfo from Config ");
            strSql.Append(" where ID=@ID");
            OleDbParameter[] parameters = {
                    new OleDbParameter("@ID", OleDbType.Integer,4)
            };
            parameters[0].Value = ID;

            HD.PWManage.Model.Config model = new HD.PWManage.Model.Config();
            DataSet ds = DbHelperOleDb.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }