在C#里查询结果是返回DataSet 怎么做?
publicDataSetselectAllreplynoteByNoteId(intid){stringsql="select*fromreplynotewhereno...
public DataSet selectAllreplynoteByNoteId(int id) { string sql = "select * from replynote where noteid = @id"; SqlParameter[] values = new SqlParameter[] { new SqlParameter("id",id) }; DataSet ds = new DataSet(); Replynote replynote = null; using (SqlDataReader reader = DBHelper.GetReader(sql, values)) { while (reader.Read()) { replynote = new Replynote(); replynote.Id = Convert.ToInt32(reader["id"].ToString()); replynote.replys.Id = Convert.ToInt32(reader["replyid"].ToString()); replynote.notes.Id = Convert.ToInt32(reader["noteid"].ToString()); replynote.Replygameid = Convert.ToInt32(reader["replygameid"].ToString()); replynote.Replytitle = reader["replytitle"].ToString(); replynote.Replycontext = reader["replycontext"].ToString(); replynote.Replytime = reader["replytime"].ToString(); ds. } reader.Close(); return ds; } } 怎么把实体类放在ds中啊??请高手指教???
展开
若以下回答无法解决问题,邀请你更新回答
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询