I have two ASP pages. They basically query a database, and spit out the
information as plain text in CSV format.
The first has the SQL query hardcoded into it. The second takes a SQL
query from a webform.
Now, the hardcoded results, I can click "Save Page As" when the results
come up and save it as a text file.
The other, while it seems to be the same results exactly, gives me an
error when I try to save the page locally: "The link could not be saved.
The web page might have been moved or had it's name changed." !?!?
The page has not been moved, nor had it's name changed. In fact, what's
sent back to the browser in each case if virtually (if not actually)
identical.
What's the problem?
[begin code from page that cannot be saved]
<!--#include file="path/to/datasource.asp" -->
<%
response.ContentType="text/plain"
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open sDataSource
Dim sql
Dim count
sql = Request.Form("sql")
Set objConn = oConn.Execute(sql)
fieldCount = ((objConn.Fields.Count) - 1)
Do Until objConn.EOF
For count = 0 to fieldCount
Response.Write "'" & objConn(count) & "'"
If count <> fieldCount Then
Response.Write ","
Else
Response.Write VbCr
End If
Next
objConn.MoveNext
Loop
%>
[end code]
[begin code from hardcoded page that can be saved]
<!--#include file="path/to/datasource.asp" -->
<%
response.ContentType="text/plain"
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open sDataSource
sql = "SELECT TABLE1.StudentFirstName, TABLE1.StudentLastName, "
sql = sql & "TABLE1.StudentEffectiveEnrollmentDate, TABLE1.StudentTel,
TABLE1.StudentAddress1,"
sql = sql & "TABLE1.StudentAddress2, TABLE1.StudentCity, TABLE1.StudentZip,"
sql = sql & "TABLE2.InventoryKitID,TABLE2.InventoryKitItem1ID, "
sql = sql & "TABLE2.InventoryKitItem2ID,TABLE2.InventoryKitIte m3ID,"
sql = sql & "TABLE2.InventoryKitItem4ID,TABLE2.InventoryKitIte m5ID,"
sql = sql & "TABLE2.InventoryKitItem6ID "
sql = sql & "FROM TABLE1 INNER JOIN TABLE2 ON "
sql = sql & "TABLE1.StudentID = TABLE2.InventoryKitStudentID "
sql = sql & "WHERE TABLE2.InventoryKitInventoryKitStatusID = 1 AND
TABLE2.InventoryKitStudentID <> 0 "
sql = sql & "ORDER BY TABLE1.StudentLastName"
Set objConn = oConn.Execute(sql)
Dim X
X = 1
Response.Write "'Last Name',"
Response.Write "'First Name',"
Response.Write "'EED',"
Response.Write "'Phone',"
Response.Write "'Address 1',"
Response.Write "'Address 2',"
Response.Write "'City',"
Response.Write "'Zip',"
Response.Write "'Kit',"
Response.Write "'CPU',"
Response.Write "'Monitor',"
Response.Write "'Printer',"
Response.Write "'Printer Cable',"
Response.Write "'Curcuit Breaker',"
Response.Write "'Headphones"&VbCr
Do Until objConn.EOF
Response.Write "'"&objConn("StudentLastName")&"',"
Response.Write "'"&objConn("StudentFirstName")&"',"
Response.Write "'"&objConn("StudentEffectiveEnrollmentDate")& "',"
Response.Write "'"&objConn("StudentTel")&"',"
Response.Write "'"&objConn("StudentAddress1")&"',"
Response.Write "'"&objConn("StudentAddress2")&"',"
Response.Write "'"&objConn("StudentCity")&"',"
Response.Write "'"&objConn("StudentZip")&"',"
Response.Write "'"&objConn("InventoryKitID")&"',"
Do Until X = 7
If objConn("InventoryKitItem"&X&"ID") > 1 AND
objConn("InventoryKitItem"&X&"ID") < 999999Then
sql = "SELECT InventorySerialNumber FROM TABLE3 WHERE InventoryID="
sql = sql & objConn("InventoryKitItem"&X&"ID")
Set objConn2 = oConn.Execute(sql)
Response.Write "'"&objConn2("InventorySerialNumber")
Else
Response.Write "'"
End If
X = X + 1
If X <> 7 Then
Response.Write "',"
Else
Response.Write "'" & VbCr
End If
Loop
X = 1
objConn.MoveNext
Loop
%>
[end code]
--
Sugapablo :: ru********@sugapablo.com
http://www.sugapablo.com | ICQ:902845