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

作者:袖梨 2022-07-02


<%
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
%>

相关文章

精彩推荐