ASP網(wǎng)頁制作 怎么從數(shù)據(jù)庫里調(diào)取最新文章題目,顯示在網(wǎng)頁里

2022-10-11 23:47

2022-10-12 00:14
sql1="select Top 1 ID,Title,Images,ArtDescription,TitleFontColor from Yao_Article where yn = 0 and IsTop = 1 and IsHot = 1 order by DateAndTime desc"

中的 Top 1 ID 那里,你可以修改1的數(shù)字,比如你要5條,就可把此語句改為
sql1="select Top 5 ID,Title,Images,ArtDescription,TitleFontColor from Yao_Article where yn = 0 and IsTop = 1 and IsHot = 1 order by DateAndTime desc"
更多回答
1 看你的樣子,你是要將文件名全部顯示嗎?
2 select Top 1 ID,Title,Images,ArtDescription,TitleFontColor from Yao_Article where yn = 0 and IsTop = 1 and IsHot = 1 order by DateAndTime desc中Top 1,不是只顯示一個的意思嗎?
3 還有,數(shù)據(jù)庫選擇的時候,你是打算在怎么選擇呢?模糊查詢不是也可以一下子選擇出幾個名稱相似的文件嗎?
你到網(wǎng)上好好找找資料吧
sql1="select Top 10 ID,Title,Images,ArtDescription,TitleFontColor from Yao_Article where yn = 0 and IsTop = 1 and IsHot = 1 order by DateAndTime desc"

這是選取前10條記錄
熱門問答