Exemplo n.º 1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public RuRo.Model.FP_LINKAGE DataRowToModel(DataRow row)
 {
     RuRo.Model.FP_LINKAGE model = new RuRo.Model.FP_LINKAGE();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (row["Name"] != null)
         {
             model.name = row["name"].ToString();
         }
         if (row["fromid"] != null && row["fromid"].ToString() != "")
         {
             model.fromid = int.Parse(row["fromid"].ToString());
         }
     }
     return model;
 }
Exemplo n.º 2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public RuRo.Model.FP_LINKAGE GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 id,fromid,name from FP_LINKAGE ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters = {
                    new SqlParameter("@id", SqlDbType.Int,4)
            };
            parameters[0].Value = id;

            RuRo.Model.FP_LINKAGE model = new RuRo.Model.FP_LINKAGE();
            DataSet ds = DbHelperSQL_SY.QuerySY(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }