一聚教程网:一个值得你收藏的教程网站

热门教程

asp 入门教程-读取数据库信息并更新

时间:2022-07-02 22:36:42 编辑:袖梨 来源:一聚教程网


<%
Dim id
Dim Rs,Sql
id = Replace(Trim(Request.QueryString("id")),"'","")
If Session("id"&id)<>"" Then
 Set Rs = Server.CreateObject("ADODB.Recordset")
 Sql = "Select * From News Where id="&id
 Rs.Open Sql,Conn,3,3
 If Rs.Eof And Rs.Bof Then
  Response.Write("NoData")
 Else
  Response.Write("Dig")
  Response.Write(",")
  Response.Write(Rs("Dig"))
 End If
Else
 Set Rs = Server.CreateObject("ADODB.Recordset")
 Sql = "Select * From News Where id="&id
 Rs.Open Sql,Conn,3,3
 If Rs.Eof And Rs.Bof Then
  Response.Write("NoData")
 Else
  Dim Dig
  Dig =Rs("Dig")
  Dig = Dig + 1
  Rs("Dig") = Dig
  Rs.Update
  Rs.Close
  Set Rs = Nothing
  Session("id"&id) = id
  Response.Write(Dig)
 End If
End If
%>

热门栏目