Object required
Når jeg kører scriptet får jeg følgende fejl:Microsoft VBScript runtime error '800a01a8'
Object required
/Importer/Preview.asp, line 98
Scriptet ser ud til at køre ok, - tekstfilen bliver hentet og vist, og den skriver fejlmeddelelsen nedenunder!
Scriptet er en del af en større helhed, og jeg kan godt komme videre fra det.
Har nogen et bud? Her kommer koden.
<!-- #include virtual="/Importer/OpenDB.asp"-->
<%
If Request("IPID") <> "" Then
Set RS = conn.execute("SELECT * FROM tblImportProfile WHERE fldIPID = " & Request("IPID"))
If Request.Form("Preview") <> "TRUE" AND RS("fldFieldDelim") > 0 Then
Delimiter = Chr(RS("fldFieldDelim"))
Qualifier = Chr(RS("fldTextQualifier"))
If RS("fldFirstLineName") = -1 Then FirstRowName = True
Else
Delimiter = Request.Form("FieldDelim")
Qualifier = Request.Form("TextQualifier")
If Request.Form("FirstRowContainsName") = "TRUE" Then FirstRowName = True
End If
FixOrDelim = RS("fldFixOrDelim")
Else
FixOrDelim = "ALL"
End If
' Open the file ready for reading
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.OpenTextFile(Server.MapPath("/Importer/Incomming/" & Request("File")), 1, 0)
SELECT CASE (FixOrDelim)
CASE "D"
' Its Delimited so its nice and easy
' Open the file and read in 1 line at a time replacing the Text Qualifier and Delimniter with <TD> etc
' Start Reading the file
i=0
Do While a.AtEndOfStream = False AND i <10
If Qualifier <> "" Then
strDemoTxt = strDemoTxt & "<tr>" & Replace(Replace(Replace(a.ReadLine, Qualifier & Delimiter & Qualifier, "</td><td>"), Qualifier & vbCrLf, "</td>" & vbCrLf), Qualifier, "<td>") & "</tr>" & vbCrLf
Else
strDemoTxt = strDemoTxt & "<tr><td>" & Replace(Replace(a.ReadLine, Delimiter, "</td><td>"), vbCrLf, "</td></tr>" & vbCrLf)
End If
' This is a bug fix cos I cant be bothered to workoout how to do it spot on first time... HEY its friday afternoon... gimme a break already!
strDemoTxt = Replace(strDemoTxt, "<td></tr>", "</td></tr>")
If i=0 AND FirstRowName = True Then
strDemoTxt = Replace(Replace(strDemoTxt, "<tr>", "<tr bgcolor=" & chr(34) & "#CCCCCC" & Chr(34) & ">"), "td>", "th>")
End If
i=i+1
Loop
CASE "F"
Set URS = conn.execute("SELECT * FROM tblIPDetail WHERE fldIPID = " & Request("IPID") & " ORDER BY fldFieldLoc ASC")
ReDim ColInfo(2,0)
n=0
Do While Not URS.Eof
ReDim Preserve ColInfo(2,n)
ColInfo(0,n) = CInt(URS("fldStart"))+1
ColInfo(1,n) = CInt(URS("fldWidth"))
n=n+1
URS.MoveNext
Loop
ColCount = n-1
i=0
Do While a.AtEndOfStream <> True AND i <10
strDemoTxt = strDemoTxt & "<tr>"
srcString = a.ReadLine
For n=0 To ColCount
strDemoTxt = strDemoTxt & "<td>" & Mid(srcString, ColInfo(0,n), ColInfo(1,n)) & "</td>"
Next
If i=0 AND FirstRowName = True Then
strDemoTxt = Replace(Replace(strDemoTxt, "<tr>", "<tr bgcolor=" & chr(34) & "#CCCCCC" & Chr(34) & ">"), "td>", "th>")
End If
i=i+1
strDemoTxt = strDemoTxt & "</tr>"
Loop
CASE ELSE
' Just show top 10 since this is probably just the first stage
i=0
MaxLength = Len(a.ReadLine)+10
Do While a.AtEndOfStream <> True AND i <10
strDemoTxt = strDemoTxt & a.ReadLine & "<BR>"
i=i+1
Loop
For n=0 to MaxLength
strSpacer = strSpacer & "*"
Next
a.close
Set a = Nothing
END SELECT
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table border="1" cellpadding="2" cellspacing="0" bordercolor="#000000">
<%= strDemoTxt %>
<font color="#FFFFFF"><%= strSpacer %></font>
</table>
<%
' Close the file off and kill the object cos we dont need them anymore
a.Close
Set a = Nothing
Set fs = Nothing
%>
</body>
</html>
