帮我看下这段asp实现excel导入sql的代码

来源:百度知道 编辑:UC知道 时间:2024/05/25 09:18:34
以下是excel.htm代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<form action="excelTosql.asp" method="post" name="form1" id="form1">
<p>
<input name="bbb" type="file" id="bbb" size="30" />

</p>
<p>
<input type="submit" name="Submit" ="提交" /

感觉不对路子,看看这个是不是比较简单
<%set conn = server.createobject("adodb.connection")
'connstr="driver={microsoft excel driver (*.xls)};ReadOnly=0;dbq="&server.mappath("aa.xls")
'connstr="driver={Microsoft Excel Driver (*.xls)};ReadOnly=0;dbq=" & server.mappath("aa.xls")
'connstr= "driver={Microsoft Excel-Treiber (*.xls)};ReadOnly=0;dbq=" & server.mappath("aa.xls")
'connstr="driver={Driver do Microsoft Excel (*.xls)};ReadOnly=0;dbq=" & server.mappath("aa.xls")

connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="& server.mappath("aa.xls") &" ;Extended Properties=Excel 8.0"
conn.open connstr%>
<% set rs = server.CreateObject("adodb.recordset")
sql="select * from [Page1$]"
rs.open sql, conn ,1,1
if rs.eof then
response.Write "无数据"
else
do while