一个ASP+ACCESS的问题

来源:百度知道 编辑:UC知道 时间:2024/05/20 11:32:24
我数据库中表news结构:
id title neirong type
1 新闻一 内容一 国际新闻
2 新闻二 内容二 国际新闻
3 新闻三 内容三 校园公告
4 新闻四 内容四 校园公告
5 新闻五 内容五 校园公告
6 新闻六 内容六 国内动态
-----------------------------------
如何用ASP读出如下表样式的数据,我想分类显示新闻列表.
比如:点击国际新闻就只会列出,1,2条的记录
校园公告
国内动态
国际新闻
-----------------------------------
帮我写下怎么列出上面这三条的信息的SQL查询代码就可以了.
要ACCESS的.
显示新闻标题的会.我要的是显示新闻分类的代码....

校园公告
国内动态
国际新闻

如果好的话.追加20分...

左侧显示新闻分类/右侧显示新闻内容/

dim newstitle,newstype
type=request("type")
sql="select * from [news] where type='" +type+"'"
rs.open sql,conn,1,1
if not rs.eof then
do while not rs.eof
newstitle=rs("title")&""
newstype=rs("type")&""
rs.movenext
loop
end if

你要显示新闻分类,最好要再建立一个新闻分类的数据表,然后运用相同方式,依次读出新闻分类

t=replace(request("newsType"),"'","''") '这个就是新闻分类的名称

sql="select * from [news]"
if t<>"" then sql=sql & " where [type]='" & t & "'"

rs.open sql,conn,1,1
......