📄 save_danwei.asp
字号:
<!--#include file="conn.asp"-->
<title>数据导入</title><%
dim recCnt,i,j,sql,sqlstr,exname,id,sql2,rs
recCnt=cint(request.form("recCnt"))
ExName=trim(request.form("ExName"))
dim danwei_bm,danwei_name
response.write "<font color=#ff0000 >正在写入数据......</font><br><br>"
'批量录入数据
j=0
id=0
for i=1 to recCnt
danwei_bm=trim(request.form("danwei_bm")(i))
danwei_name=trim(request.form("danwei_name")(i))
if danwei_name="" then
'归口区分开始
sql_guikou="select * from guikou where guikou_name='"&danwei_bm&"' order by id desc"
Set rs_guikou= Server.CreateObject("ADODB.Recordset")
rs_guikou.open sql_guikou,conn,1,1
if not (rs_guikou.bof and rs_guikou.eof) then
guikou_id=rs_guikou("id")
else
Conn.execute "Insert guikou (guikou_name,cost_delete) values('"&danwei_bm& "',0)"
sql2="select @@identity as guikou_id"
set rs1 = server.CreateObject("adodb.recordset")
rs1.open sql2,conn,1,3
guikou_id=rs1("guikou_id")
end if
'归口区分结束
else
sql="select * from danwei where guikou_id="&guikou_id&" and danwei_name='"&danwei_name& "' order by id desc"
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,1
if rs.bof and rs.eof then
Conn.execute "Insert danwei (guikou_id,danwei_name,cost_delete) values("&guikou_id& ",'"& danwei_name & "',0)"
sql2="select @@identity as danwei_id"
set rs = server.CreateObject("adodb.recordset")
rs.open sql2,conn,1,3
danwei_id=rs("danwei_id")
response.write "<font color=#000000>id=:</font><font color=red>"&danwei_id&"</font><br>"
else
j=j+1
response.write "<font color=#000000>id=:</font><font color=red>"&rs("id")&"</font><br>"
response.write "<font color=#000000>excel表中的数据重复:</font><font color=red>"&danwei_bm&danwei_name&kind&"</font><br>"
end if
end if
next
response.write "<font color=#000000>excel表---"&exname&"中的组数据 "& recCnt-j & " 条记录成功写入数据库!"&j&"条记录重复</font>"
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -