读Excel表的问题
<%Dim conn
Dim StrConn
Dim Rs
Dim Sql
Dim i
Dim ExName
Set conn =Server.CreateObject("ADODB.Connection")
StrConn="Driver={Microsoft Excel Driver (*.xls)};DBQ=" & Server.MapPath("../emapgo.xls")
conn.Open StrConn
Set rs = Server.CreateObject("ADODB.Recordset")
Sql="select * from [Sheet1$]"
rs.Open Sql,conn,3,3
%>
<p align="center">请确认Excel表中的字段与Access表中的字段相同! </p>
<form id="form1" name="form1" method="post" action="Excel.asp">
<table width=780 border="1" align="center" cellpadding="0" cellspacing="0" bordercolorlight="#FFFFFF" bordercolordark="#ECF5FF" style='FONT-SIZE: 9pt'>
<tr align=center>
<%
for ii=0 to rs.Fields.Count-1
%>
<td align=center><input name=piaoy<%=ii%> value="<%=replace(Rs(ii).Name," ","")%>" size="20"></td>
<%Next%>
</tr>
</table>
<% Response.Write "<table width=780 border=0 align=center cellspacing=1 bgcolor=#EFF1EF>"
Response.Write "<tr bgcolor=white><td align=center>"
Dim a
a=0
do while not rs.eof
for i=0 to rs.Fields.Count-1
if i mod rs.Fields.Count = 0 then
Response.Write "<br>"
End if
%>
<input name=<%=Rs(i).Name%> value="<%=replace(Rs(i)," ","")%>" size="25"> .....,........第 55 行
<%
a = a +1
next
rs.MoveNext
Loop
Response.Write "</td></tr><tr><td align=center><input type=submit value=导入数据></td></tr></table>"
Response.Write "</form>"
rs.close
set rs=nothing
conn.close
set StrConn=nothing
Response.End
%>
</form>
当我Excel里有空值时
错误类型:
Microsoft VBScript 运行时错误 (0x800A005E)
无效使用 Null: 'replace'
/asp/WebMap/admin/Info_Add.asp, 第 55 行
请问这怎么解决呀
[此贴子已经被作者于2006-9-8 9:31:20编辑过]