/// <summary> /// 得到一个对象实体 /// </summary> public coodroid.Model.model.comicsType DataRowToModel(DataRow row) { coodroid.Model.model.comicsType model = new coodroid.Model.model.comicsType(); 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(); } } return(model); }
/// <summary> /// 得到一个对象实体 /// </summary> public coodroid.Model.model.comicsType GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select id,name from comicsType "); strSql.Append(" where id=@id"); SQLiteParameter[] parameters = { new SQLiteParameter("@id", DbType.Int32, 4) }; parameters[0].Value = id; coodroid.Model.model.comicsType model = new coodroid.Model.model.comicsType(); DataSet ds = DbHelperSQLite.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }