OleDbDataAdapter da=new OleDbDataAdapter("select top 8 NewsOrder,ItemID,CreatedDate,Title from News where (IsHot=true and IsCheck=true ) ",myConnection);C#操作access 如上的的话取出来的数据确实是8条了如果sql语句加上ORDER BY CreatedDate排序 如下
然后取出啦的数据条数就不对了 多于8条了
OleDbDataAdapter da=new OleDbDataAdapter("select top 8 NewsOrder,ItemID,CreatedDate,Title from News where (IsHot=true and IsCheck=true ) ORDER BY CreatedDate",myConnection);
然后取出啦的数据条数就不对了 多于8条了
OleDbDataAdapter da=new OleDbDataAdapter("select top 8 NewsOrder,ItemID,CreatedDate,Title from News where (IsHot=true and IsCheck=true ) ORDER BY CreatedDate",myConnection);
select top 8 * from (select NewsOrder,ItemID,CreatedDate,Title from News where (IsHot=true and IsCheck=true ) ORDER BY CreatedDate)
界面:http://blog.csdn.net/Qqwwee_Com/archive/2005/11/05/523395.aspx
下载:http://szlawbook.com/csdnv2***
我们每回答一个问题,
就谋杀了提问者一个思考的机会,
而这个思考的机会可能让他获得10倍的知识,
所以,我们不下地狱谁下地狱?
***#endregion
看看行不行。
你这应该是创建日期吧
因为CreatedDate可能相同的,如果你用select top 1 from 表 order by createDate
因为CreatedDate列可能有很多相同日期的,也就是值相同,这时候会把所有相同的值都检索出来的,
select distinct好像是检索不同的记录吧,
最好的办法是创建一个id字段,设置为关键字,主键,让它自动加一,这样就不会有相同的id记录了
然后用id来检索