批量复制数据

2018-09-06 12:38

阅读:493

  现有表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)};
OnErrorResumeNext
conn.openconnstr
%>
<html>
<head>
<title>管理软件</title>
<metahttp-equiv=Content-Typecontent=text/html;charset=gb2312>
</head>
<bodybgcolor=#FFFFFFtext=#000000>
<tablewidth=700border=0cellspacing=0cellpadding=0align=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)
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=0cellspacing=0cellpadding=0align=center>
<tr>
<tdheight=21bgcolor=#F7F7F7align=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>


评论


亲,登录后才可以留言!