萬盛學電腦網

 萬盛學電腦網 >> 網絡編程 >> asp編程 >> asp+access sql insert into select表復制

asp+access sql insert into select表復制

這裡是把一個同的數據一次性保存到另一個表,用的是sql insert into  select另一張同結構的新表

sub append()
call opendb()
dim zsql,zdysql
zsql="insert into zdgz select title,s_name,user_from,image,content,send_date,isture from zdy "
 conn.execute(zsql)
 if err=0 then
  response.write("<br><hr>")
 response.write("<font  class=style1 >Data successful merger</font><hr><br>")
 conn.execute("delete * from zdy")
 else
  response.write("<br><hr><br>")
 response.write("<font  class=style1>If you are repeatedly running a home, data merge successfully.If you are running the first page, the data failed merger.</font><hr><br><br><br><br><br><br><p></p>")
 end if
end sub

數據連接代碼

sub opendb()
set rs=server.CreateObject("adodb.recordset")
set conn=server.CreateObject("adodb.connection")
conn.connectionstring="provider=microsoft.jet.oledb.4.0; data source="&server.mappath("datasource/hhinfo.mdb")
conn.open
end sub


 

copyright © 萬盛學電腦網 all rights reserved