📄 a.asp
字号:
<!--#include file="conn.asp"-->
<!--#include file="command.asp"-->
<%
dim mu_1, mu_2,mu_3,mu_4,mu_5, mu_6,mu_7,mu_8,mu_9,mu_10'目的字段
dim yuan_1,yuan_2,yuan_3,yuan_4,yuan_5,yuan_6,yuan_7,yuan_8,yuan_9,yuan_10'源字段
dim mu_table'目的表
dim yuan_table'源表
dim mubiao_fujia_sql'目标附加字段附值
dim yuan_fujia_sql'源记录选取条件
n=0
'''''''源数据表名''''''''''''''''''''''''''''''
yuan_table=request.form("yuan_table")
'''''''''''''''''''''''''''''''''''''''''''''''
'''''''目的数据表名''''''''''''''''''''''''''''''
mu_table=request.form("mu_table")
''''''''''''''''''''''''''''''''''''''''''''''''
''''''''源数据表附加过滤'''''''''''''''''''''''
yuan_fujia_sql=request.form("yuan_fujia_sql")
if yuan_fujia_sql<>"" then
yuan_fujia_sql="where"+" " &yuan_fujia_sql
end if
'''''''''''''''''''''''''''''''''''''''''''''''
''''''''目的数据表附加赋值'''''''''''''''''''''''
mubiao_fujia_sql=request.form("mubiao_fujia_sql")
if mubiao_fujia_sql<>"" then
mubiao_fujia_sql_null=mubiao_fujia_sql
mubiao_fujia_sql=","&mubiao_fujia_sql
end if
mubiao_fujia_zhi_sql=request.form("mubiao_fujia_zhi_sql")
if mubiao_fujia_zhi_sql<>"" then
mubiao_fujia_zhi_sql=","&mubiao_fujia_zhi_sql
end if
'''''''''''''''''''''''''''''''''''''''''''''''
'''''''源字段列表'''''''''''''''''''''''''''''
yuan_1=request.form("yuan_1")
yuan_2=request.form("yuan_2")
yuan_3=request.form("yuan_3")
yuan_4=request.form("yuan_4")
yuan_5=request.form("yuan_5")
yuan_6=request.form("yuan_6")
yuan_7=request.form("yuan_7")
yuan_8=request.form("yuan_8")
yuan_9=request.form("yuan_9")
yuan_10=request.form("yuan_10")
''''''''''''''''''''''''''''''''''''''''''''''''
'''''''目标字段列表'''''''''''''''''''''''''''''
mu_1=request.form("mu_1")
mu_2=request.form("mu_2")
mu_3=request.form("mu_3")
mu_4=request.form("mu_4")
mu_5=request.form("mu_5")
mu_6=request.form("mu_6")
mu_7=request.form("mu_7")
mu_8=request.form("mu_8")
mu_9=request.form("mu_9")
mu_10=request.form("mu_10")
''''''''''''''''''''''''''''''''''''''''''''''''
'''''''主程序开始'''''''''''''''''''''''''''''
sql="select * from "&yuan_table&"" +" "&yuan_fujia_sql
Response.Write "<font color=red>源表查询语句:</font>" &sql
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
if rs.eof and rs.bof then
Response.Write "<li>源表无资料!</li><br>"
call error("源表无资料或源表附加条件表达式错误!")
else
Response.Write "<br><font color=red>源数据表操作字段:</font>"&yuan_table&":"&yuan_1&","&yuan_2&","&yuan_3&","&yuan_4&","&yuan_5&","&yuan_6&","&yuan_7&","&yuan_8&","&yuan_9&","&yuan_9&"<br>"
Response.Write "<font color=red>目标数据表操作字段:</font>"&mu_table&":"&mu_1&","&mu_2&","&mu_3&","&mu_4&","&mu_5&","&mu_6&","&mu_7&","&mu_8&","&mu_9&","&mu_10&"<br><br><br><br><br><br><br><br><br><br><br><br><br><br><hr>"
''''''''''''''''''第二个数据库操作对象''''''''''''''''''''''
sql2="select * from "&mu_table
set rs2=server.createobject("adodb.recordset")
rs2.open sql2,conn,1,1
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''类型检验''''''''''''''''''''''
if rs(yuan_1).type<>rs2(mu_1).type then
messbox=yuan_table&":"&yuan_1&"和"&mu_table&":"&mu_1&""
messbox=messbox+"<br>字段名错误或类型不匹配,强行转化可能会出现无法预知的问题!"
call error(messbox)
end if
if yuan_2<>"" then
if rs(yuan_2).type<>rs2(mu_2).type then
messbox=yuan_table&":"&yuan_2&"和"&mu_table&":"&mu_2&""
messbox=messbox+"<br>字段名错误或类型不匹配,强行转化可能会出现无法预知的问题!"
call error(messbox)
end if
end if
if yuan_3<>"" then
if rs(yuan_3).type<>rs2(mu_3).type then
messbox=yuan_table&":"&yuan_3&"和"&mu_table&":"&mu_3&""
messbox=messbox+"<br>字段名错误或类型不匹配,强行转化可能会出现无法预知的问题!"
call error(messbox)
end if
end if
if yuan_4<>"" then
if rs(yuan_4).type<>rs2(mu_4).type then
messbox=yuan_table&":"&yuan_4&"和"&mu_table&":"&mu_4&""
messbox=messbox+"<br>字段名错误或类型不匹配,强行转化可能会出现无法预知的问题!"
call error(messbox)
end if
end if
if yuan_5<>"" then
if rs(yuan_5).type<>rs2(mu_5).type then
messbox=yuan_table&":"&yuan_5&"和"&mu_table&":"&mu_5&""
messbox=messbox+"<br>字段名错误或类型不匹配,强行转化可能会出现无法预知的问题!"
call error(messbox)
end if
end if
if yuan_6<>"" then
if rs(yuan_6).type<>rs2(mu_6).type then
messbox=yuan_table&":"&yuan_6&"和"&mu_table&":"&mu_6&""
messbox=messbox+"<br>字段名错误或类型不匹配,强行转化可能会出现无法预知的问题!"
call error(messbox)
end if
end if
if yuan_7<>"" then
if rs(yuan_7).type<>rs2(mu_7).type then
messbox=yuan_table&":"&yuan_7&"和"&mu_table&":"&mu_7&""
messbox=messbox+"<br>字段名错误或类型不匹配,强行转化可能会出现无法预知的问题!"
call error(messbox)
end if
end if
if yuan_8<>"" then
if rs(yuan_8).type<>rs2(mu_8).type then
messbox=yuan_table&":"&yuan_8&"和"&mu_table&":"&mu_8&""
messbox=messbox+"<br>字段名错误或类型不匹配,强行转化可能会出现无法预知的问题!"
call error(messbox)
end if
end if
if yuan_9<>"" then
if rs(yuan_9).type<>rs2(mu_9).type then
messbox=yuan_table&":"&yuan_9&"和"&mu_table&":"&mu_9&""
messbox=messbox+"<br>字段名错误或类型不匹配,强行转化可能会出现无法预知的问题!"
call error(messbox)
end if
end if
if yuan_10<>"" then
if rs(yuan_10).type<>rs2(mu_10).type then
messbox=yuan_table&":"&yuan_10&"和"&mu_table&":"&mu_10&""
messbox=messbox+"<br>字段名错误或类型不匹配,强行转化可能会出现无法预知的问题!"
call error(messbox)
end if
end if
''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''目的字段处理''''''''''
if mu_2<>"" then
mu_2=","&mu_2
end if
if mu_3<>"" then
mu_3=","&mu_3
end if
if mu_4<>"" then
mu_4=","&mu_4
end if
if mu_5<>"" then
mu_5=","&mu_5
end if
if mu_6<>"" then
mu_6=","&mu_6
end if
if mu_7<>"" then
mu_7=","&mu_7
end if
if mu_8<>"" then
mu_8=","&mu_8
end if
if mu_9<>"" then
mu_9=","&mu_9
end if
if mu_10<>"" then
mu_10=","&mu_10
end if
''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''循环赋值''''''''''
do while not rs.eof
temp1=rs(yuan_1)
if rs(yuan_1).type<>3 then'如果不是数字类型加上括号
temp1="'"&temp1&"'"
end if
''''''''''''''''''''''''''
temp2=rs(yuan_2)
if temp2<>"" then
if rs(yuan_2).type<>3 then'如果不是数字类型加上括号
temp2=",'"&temp2&"'"
else
temp2=","&temp2
end if
end if
''''''''''''''''''''''''''
temp3=rs(yuan_3)
if temp3<>"" then
if rs(yuan_3).type<>3 then'如果不是数字类型加上括号
temp3=",'"&temp3&"'"
else
temp3=","&temp3
end if
end if
''''''''''''''''''''''''''
temp4=rs(yuan_4)
if temp4<>"" then
if rs(yuan_4).type<>3 then'如果不是数字类型加上括号
temp4=",'"&temp4&"'"
else
temp4=","&temp4
end if
end if
''''''''''''''''''''''''''
temp5=rs(yuan_5)
if temp5<>"" then
if rs(yuan_5).type<>3 then'如果不是数字类型加上括号
temp5=",'"&temp5&"'"
else
temp5=","&temp5
end if
end if
''''''''''''''''''''''''''
''''''''''''''''''''''''''
temp6=rs(yuan_6)
if temp6<>"" then
if rs(yuan_6).type<>3 then'如果不是数字类型加上括号
temp6=",'"&temp6&"'"
else
temp6=","&temp6
end if
end if
''''''''''''''''''''''''''
''''''''''''''''''''''''''
temp7=rs(yuan_7)
if temp7<>"" then
if rs(yuan_7).type<>3 then'如果不是数字类型加上括号
temp7=",'"&temp7&"'"
else
temp7=","&temp7
end if
end if
''''''''''''''''''''''''''
''''''''''''''''''''''''''
temp8=rs(yuan_8)
if temp8<>"" then
if rs(yuan_8).type<>3 then'如果不是数字类型加上括号
temp8=",'"&temp8&"'"
else
temp8=","&temp8
end if
end if
''''''''''''''''''''''''''
''''''''''''''''''''''''''
temp9=rs(yuan_9)
if temp9<>"" then
if rs(yuan_9).type<>3 then'如果不是数字类型加上括号
temp9=",'"&temp9&"'"
else
temp9=","&temp9
end if
end if
''''''''''''''''''''''''''
''''''''''''''''''''''''''
temp10=rs(yuan_10)
if temp10<>"" then
if rs(yuan_10).type<>3 then'如果不是数字类型加上括号
temp10=",'"&temp10&"'"
else
temp10=","&temp10
end if
end if
''''''''''''''''''''''''''
sql88="insert into "&mu_table&" ("&mu_1&""&mu_2&""&mu_3&""&mu_4&""&mu_5&""&mu_6&""&mu_7&""&mu_8&""&mu_9&""&mu_10&" "&mubiao_fujia_sql&")values("&temp1&""&temp2&""&temp3&""&temp4&""&temp5&""&temp6&""&temp7&""&temp8&""&temp9&""&temp10&" "&mubiao_fujia_zhi_sql&")"
Response.Write "sql序列:"&sql88&"<br>"
conn.execute sql88
n=n+1
rs.movenext
loop
end if
''''''''''''''''''''''''''
rs2.close
set rs2=nothing
''''''''''''''''''''''''''
rs.close
set rs=nothing
Response.Write "<br><br><br><br><br><br><br><br>"
message="成功导入"&n&"条记录!"
call ok(message)
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -