<%
dim sqlWord as String="select top 7 * from news where focusnews=true order by newsid desc"
dim mycmdWord as oledbcommand=new oledbcommand(sqlWord,myconn)
dim myreaderWord as oledbdatareader=mycmdWord.executereader()
%>
<td bgcolor="" style="WORD-WRAP: break-word" class="news">
<%
Dim WordNextResult As Boolean = True
Do Until Not WordNextResult
Do While myReaderWord.Read()
%><a href="shownews.aspx?newsid=<%=myReaderWord.item("newsid")%>"><%=myReaderWord.item("title")%></a>
<%
Loop
WordNextResult = myReaderWord.NextResult()
Loop
myReaderWord.close()
%>
博客内容包含一段代码,用于在Web环境中查询新闻数据。通过SQL语句从news表中选取焦点新闻,使用OleDbCommand和OleDbDataReader执行查询并读取结果,最后将新闻标题展示出来。
914

被折叠的 条评论
为什么被折叠?



