<!--#include file="conn.asp" -->
<%
action=request("action")
if action="daoru" then
Set oConn = Server.CreateObject("ADODB.Connection")
Driver = "Driver={Microsoft Excel Driver (*.xls)};"
Path = "DBQ=" &Server.MapPath("../tongxunlu.xls")
oConn.Open Driver &Path
Sql="Select * From [Sheet1$]"
Set Rs=oConn.Execute(Sql)
IF Rs.Eof And Rs.Bof Then
Response.write "没有数据!!"
Else
Do While Not Rs.EOF
set vrs=Server.CreateObject("ADODB.Recordset")
vSQL="SELECT * FROM TongXunLu where t_Name='"&Rs("Names")&"' and t_tel='"&Rs("Tel")&"' order by id asc"
vrs.Open vSQL, conn, 1, 3
TxlNum=vrs.recordcount
if TxlNum=0 then
vrs.AddNew()
vrs("t_Name")=rs("Names")
vrs("t_Sex")=rs("sex")
vrs("t_Tel")=rs("Tel")
vrs("t_Email")=rs("email")
vrs("t_Address")=rs("address")
vrs("t_Post")=rs("postcode")
vrs.Update()
end if
Rs.MoveNext
Loop
End IF
Response.Write("<script>alert('导入成功!');location='admin_tongxunlu.asp';</script>")
end if
%>