萬盛學電腦網

 萬盛學電腦網 >> 網絡編程 >> asp編程 >> asp 入門教程-讀取數據庫信息並更新

asp 入門教程-讀取數據庫信息並更新

<!--#include File="conn.asp"-->
<%
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
%>

copyright © 萬盛學電腦網 all rights reserved