asp如何大批量更新数据
本人的网站程序是用asp+sql2000做的
现在想做的是:输入点击数,然后提交.
在表Merchant_News中就完成所有的数据中的count字段就全部更新.
在数据库里面执行
Update Merchant_News Set Count=Count+1
能成功.
但在程序里面.(要是直接看很难受的话,可以复制下来,放在DW里看,谢谢!)
<!--#include file= "../Conn.asp " -->
<!--#include file= "Inc/Session.asp " -->
<!--#include file= "../Inc/Char.asp " -->
<!--#include file= "Inc/priv.asp " -->
<html>
<head>
<title> <%=SysVer%> > > </title>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 ">
<link rel= "stylesheet " href= "css/Style.css " type= "text/css ">
</head>
<body topmargin= "0 " leftmargin= "0 ">
<%
Select Case Request( "Action ")
Case "SaveAdd "
Call SaveAdd()
End Select
Sub SaveAdd()
Dim typeid,hits,Rs,Sql,AreaName
Dim Result
typeid=Clng(Trim(Request( "typeid ")))
hits=Clng(Trim(Request( "hits ")))
'Set Rs=Server.CreateObject( "ADODB.RecordSet ")
if typeid=1 then
Set Rs=conn.execute( "Update Merchant_News Set Count=Count+ "&hits& " ")
' Sql= "Select count from merchant_news "
end if
if typeid=2 then
Set Rs=conn.execute( "UPDATE Corporation_News Set COUNT=Count+ "&hits& " ")
end if
if typeid=3 then
Set Rs=conn.execute( "Update User_News Set Count=Count+ "&hits& " ")
end if
'Rs.Open Sql,conn,1,3
'Rs( "Count ")=Rs( "Count ")+hits UPDATE User_News SET
'Rs.Update
Rs.Close
'Set Rs=Nothing
Result= "点数添加成功,系统将在2秒后回到首页 "
Call warn(Result, "Add_hits.asp ",1)
End Sub
%>
<table width= "100% " border= "0 " cellpadding= "3 " cellspacing= "1 " class= "border ">
<form name= "form1 " method= "post " action= "?Action=SaveAdd " onsubmit= "return checkAdd(this) ">
<tr align= "center " bgcolor= "#000000 ">
<td colspan= "2 " class= "topbg "> <font color= "#FFFFFF "> 增加点击数 </font> </td>
</tr>
<tr>
<td width= "20% " height= "23 " align= "right " class= "tdbg "> 选择:
</td>
<td width= "80% " class= "tdbg "> <select name= "typeid " size= "1 " id= "typeid ">