日期:2014-05-17 浏览次数:21283 次
<!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
" lang="gb2312" xml:lang="gb2312">
<head>
???
<title>操作excle</title>
</head>
<body>
<%
Set xlsconn = server.CreateObject("adodb.connection")
set rs=server.CreateObject("adodb.recordset")
myConn_Xsl="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=test.xls;Extended Properties=Excel 8.0"
xlsconn.open myConn_Xsl
sql="select * from [sheet1$]"
set rs=xlsconn.execute(sql)
if not rs.eof then
%>
<table border="0" cellpadding="20" cellspacing="0" >
<tr>
<td>名称</td>
<td>编号</td>
<td>价格</td>
</tr>
<%
while not rs.eof
%>
<tr>
<td><%=rs("商品名称")%></td>
<td><%=rs("商品编号")%></td>
<td><%=rs("价格")%></td>
</tr>
<%
rs.movenext
wend
%>
</table>
<%
'sql="insert into [product](namese,pic) values('"& names &"','"& pic &"')"
'conn.execute(sql)
end if
%>
</body>
</html>