手机
当前位置:查字典教程网 >编程开发 >ASP教程 >批量复制数据
批量复制数据
摘要:现有表Special和表view数据结构相同的两个表:复制代码代码如下:SpecialSpecialidNClassnamepic1黎明火舞...

现有表Special和表view数据结构相同的两个表:

复制代码 代码如下:

Special

SpecialidNClassnamepic

1黎明火舞艳阳

2张学友地久天长

3陈冠希同名专辑

4郭富城听风的歌

view

SpecialidNClassnamepic

1黎明火舞艳阳photo/200606192321.jpg

2张学友地久天长photo/200606192327.jpg

3刘德华如果有一天photo/200606192328.jpg

4郭富城听风的歌photo/200606192329.jpg

要将VIEW中的PIC数据批量复制到Special中,(歌手名与专辑要完全相同),代码如下:

复制代码 代码如下:<%

dimconn

dimconnstr

'onerrorresumenext

connstr="DBQ="+server.mappath("p#1.mdb")+";DefaultDir=;DRIVER={MicrosoftAccessDriver(*.mdb)};"

setconn=server.createobject("ADODB.CONNECTION")

OnErrorResumeNext

conn.openconnstr

%>

<html>

<head>

<title>管理软件</title>

<metahttp-equiv="Content-Type"content="text/html;charset=gb2312">

</head>

<bodybgcolor="#FFFFFF"text="#000000">

<tablewidth=700border="0"cellspacing="0"cellpadding="0"align="center"><%

constMaxPerPage=100

dimtotalPut

dimCurrentPage

dimTotalPages

dimi,j

ifnotisempty(request("page"))then

currentPage=cint(request("page"))

else

currentPage=1

endif

%>

<%

setrs=server.CreateObject("adodb.recordset")

rs.open"select*fromSpecialinnerjoinviewonSpecial.name=view.nameandSpecial.NClass=view.NClass",conn,1,1

ifrs.eofandrs.bofthen

response.write"<palign=centerclass=font>暂无软件</p>"

else

totalPut=rs.recordcount

totalPut=rs.recordcount

ifcurrentpage<1then

currentpage=1

endif

if(currentpage-1)*MaxPerPage>totalputthen

if(totalPutmodMaxPerPage)=0then

currentpage=totalPutMaxPerPage

else

currentpage=totalPutMaxPerPage+1

endif

endif

ifcurrentPage=1then

showContent

showpagetotalput,MaxPerPage,"l.asp"

else

if(currentPage-1)*MaxPerPage<totalPutthen

rs.move(currentPage-1)*MaxPerPage

dimbookmark

bookmark=rs.bookmark

showContent

showpagetotalput,MaxPerPage,"l.asp"

else

currentPage=1

showContent

showpagetotalput,MaxPerPage,"l.asp"

endif

endif

rs.close

endif

setrs=nothing

conn.close

setconn=nothing

subshowContent

dimi

i=1

%>

<%dowhilenotrs.eof%>

<tr>

<td><%dimpicc,vname,vnclass

picc=rs("pic")

vname=rs("name")

vnclass=rs("nclass")%><%

sql="updateSpecialsetpic='"&picc&"'wherename='"&vname&"'andnclass='"&vnclass&"'"

conn.executesql

%></td>

</tr>

<%i=i+1

ifi>=MaxPerPagethenexitdo

rs.movenext

loop

%>

</table>

<tablewidth="100%"border="0"cellspacing="0"cellpadding="0"align="center">

<tr>

<tdheight="21"bgcolor="#F7F7F7"align="center">

<%

endsub

functionshowpage(totalnumber,maxperpage,filename)

dimn

iftotalnumbermodmaxperpage=0then

n=totalnumbermaxperpage

else

n=totalnumbermaxperpage+1

endif

ifCurrentPage<2then

response.write""

else

response.write"<ahref="&filename&"?page=1>首页</a>"

response.write"<ahref="&filename&"?page="&CurrentPage-1&">上一页</a>"

endif

ifn-currentpage<1then

response.write""

else

response.write"<ahref="&filename&"?page="&(CurrentPage+1)&">"

response.write"下一页</a><ahref="&filename&"?page="&n&">尾页</a>"

endif

response.write"页次:</font><b><fontcolor=red>"&CurrentPage&"</font>/"&n&"</b>页</font>"

response.write"共<b>"&totalnumber-1&"</b>个软件<b>"&maxperpage&"</b>个软件/页"

endfunction

%>

</td>

</tr>

</table>

</body>

</html>

【批量复制数据】相关文章:

asp的通用数据分页类

asp 过滤数组重复数据

水印测试(重新测试)

如何在ASP中使用数据库

用Asp备份与恢复SQL Server 数据库

asp最常用的分页函数

替换数据库内容

asp 查询数据代码

使用FSO把文本信息导入数据库

ASP数据岛操作类

精品推荐
分类导航