dim sqlFo as String="select top 1 * from news where focusnews=true order by newsid desc"
dim mycmdFo as oledbcommand=new oledbcommand(sqlFo,myconn)
dim myreaderFo as oledbdatareader=mycmdFo.executereader()
if myreaderFo.read() then
dim HotContentFo as String =myreaderFo.item("Content") //赋值需读取的内容
dim HotURLFo as String //存储读取内容
Dim rFo As New Regex("/d{18}.(jpg|gif)") //定义正则表达式
Dim mFo As Match = rFo.Match(HotContentFo) //将正则表达式与内容匹配
If mFo.Success Then
HotURLFo=mFo.Value
End If
dim mycmdFo as oledbcommand=new oledbcommand(sqlFo,myconn)
dim myreaderFo as oledbdatareader=mycmdFo.executereader()
if myreaderFo.read() then
dim HotContentFo as String =myreaderFo.item("Content") //赋值需读取的内容
dim HotURLFo as String //存储读取内容
Dim rFo As New Regex("/d{18}.(jpg|gif)") //定义正则表达式
Dim mFo As Match = rFo.Match(HotContentFo) //将正则表达式与内容匹配
If mFo.Success Then
HotURLFo=mFo.Value
End If
博客展示了一段代码,定义 SQL 语句查询新闻数据,执行查询后读取内容。使用正则表达式 /d{18}.(jpg|gif) 对读取的内容进行匹配,若匹配成功则将匹配值存储到变量中,涉及字符串操作和正则匹配。
906

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



