一段修改数据库中某字段的代码(asp)

这是昨天写的一段asp代码,功能就是用来替换数据库里某字段中的某些匹配内容
 如果数据库中行数很多的话,程序运行会有很长时间,所以如果程序运行超时的话还得修改下,把脚本超时的时间改长些,也可以修改程序输出一些成功信息

 1 None.gif < ! -- #include file = " conn.asp " -->  
 2 None.gif < % dim  rs,sql,aa,i,bb
 3 None.gif set  rs = server.createobject( " adodb.recordset "
 4 None.gifsql = " select musicid,testfilename from music where testfilename like '%.ra%'  "  
 5 None.gifrs.open sql,conn, 1 , 1  
 6 None.gif If   Not  Rs.Eof  And   Not  Rs.Bof  Then  aa = Rs.GetRows()      '获取数据集,存入数组
 7 None.gifrs.close 
 8 None.gif
 9 None.gif If   IsArray (aa)  Then   '判断是否取到
10 None.gif
11 None.gif for  i = 0   to   Ubound (aa, 2 )  '循环替换
12 None.gifbb = replace (aa( 1 ,i), " .ra " , " .mp3 "
13 None.gifsql = " select testfilename from music where musicid= " & aa( 0 ,i) 
14 None.gifrs.open sql,conn, 1 , 3   
15 None.gifrs( " testfilename " ) = bb 
16 None.gifrs.update 
17 None.gifrs.close 
18 None.gif next  
19 None.gif
20 None.gif end   if  
21 None.gif% >
posted on 2006-02-03 14:15 Aween's Blog 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/aween/archive/2006/02/03/325002.html

猜你喜欢

转载自blog.csdn.net/weixin_33739627/article/details/94574880