M
Mel
I have used a modified version of the Excel example in ASP
101 samples that has worked fine for over a year. We are
now changing over to Office 2000 and a problem is
occuring. Excel will open but my table is not built. Here
is what my code looks like. I hope someone can help. I
know that it is alot of code but I was thinking that the
problem may be in the first part of it because it is not
creating the table at all.
<%@LANGUAGE=VBScript%>
<%
Response.Expires=0
Response.Buffer = True
Response.Clear
%>
<%
Response.ContentType = "application/vnd.ms-excel"
%>
<!--#include file="adovbs.inc"-->
<%
Set db=Server.CreateObject("ADODB.Connection")
strConnect="Provider=SQLOLEDB.1;Integrated
Security=SSPI;Persist Security Info=False;Initial
Catalog=MIR;Data Source=SNNSVR140"
db.ConnectionString=strConnect
db.Open
' Create recordset
Set rs=Server.CreateObject("ADODB.Recordset")
'rs.CursorLocation = adUseClient
rs.CursorType = adOpenKeyset
rs.LockType = adLockReadOnly
'Build SQL Select Statement
SQL = "SELECT * FROM tblSkipLot Order By DocNum"
rs.Open (SQL), db
%>
<%
' Spacing
Response.Write vbCrLf
' Continue with a title row in our table
Response.Write "<table border=""1"">" & vbCrLf
' Show field names in the top row
Response.Write vbTab & "<tr>" & vbCrLf
For I = 0 To rs.Fields.Count - 1
Response.Write vbTab & vbTab & "<th>"
Response.Write rs.Fields(I).Name
Response.Write "</th>" & vbCrLf
Next 'I
Response.Write vbTab & "</tr>" & vbCrLf
' Loop through our records and ouput 1 row per record
Do Until rs.EOF
Response.Write vbTab & "<tr>" & vbCrLf
For I = 0 To rs.Fields.Count - 1
Response.Write vbTab & vbTab & "<td>"
Response.Write rs.Fields(I)
If (rs.Fields(I) = "") or isNull(rs.Fields
(I)) then
Response.Write " "
Else
Response.Write "</td>" & vbCrLf
End If
Next 'I
Response.Write vbTab & "</tr>" & vbCrLf
' Can't forget to move to the next record!
rs.MoveNext
Loop
' All done - close table
Response.Write "</table>" & vbCrLf
' Close DB objects and free variables
rs.Close
Set rs = Nothing
db.Close
Set db = Nothing
' END RUNTIME CODE
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
<meta name="Microsoft Theme" content="indust 101, default">
<meta name="Microsoft Border" content="none">
</head>
<body></body>
</html>
Thanks,
Mel
101 samples that has worked fine for over a year. We are
now changing over to Office 2000 and a problem is
occuring. Excel will open but my table is not built. Here
is what my code looks like. I hope someone can help. I
know that it is alot of code but I was thinking that the
problem may be in the first part of it because it is not
creating the table at all.
<%@LANGUAGE=VBScript%>
<%
Response.Expires=0
Response.Buffer = True
Response.Clear
%>
<%
Response.ContentType = "application/vnd.ms-excel"
%>
<!--#include file="adovbs.inc"-->
<%
Set db=Server.CreateObject("ADODB.Connection")
strConnect="Provider=SQLOLEDB.1;Integrated
Security=SSPI;Persist Security Info=False;Initial
Catalog=MIR;Data Source=SNNSVR140"
db.ConnectionString=strConnect
db.Open
' Create recordset
Set rs=Server.CreateObject("ADODB.Recordset")
'rs.CursorLocation = adUseClient
rs.CursorType = adOpenKeyset
rs.LockType = adLockReadOnly
'Build SQL Select Statement
SQL = "SELECT * FROM tblSkipLot Order By DocNum"
rs.Open (SQL), db
%>
<%
' Spacing
Response.Write vbCrLf
' Continue with a title row in our table
Response.Write "<table border=""1"">" & vbCrLf
' Show field names in the top row
Response.Write vbTab & "<tr>" & vbCrLf
For I = 0 To rs.Fields.Count - 1
Response.Write vbTab & vbTab & "<th>"
Response.Write rs.Fields(I).Name
Response.Write "</th>" & vbCrLf
Next 'I
Response.Write vbTab & "</tr>" & vbCrLf
' Loop through our records and ouput 1 row per record
Do Until rs.EOF
Response.Write vbTab & "<tr>" & vbCrLf
For I = 0 To rs.Fields.Count - 1
Response.Write vbTab & vbTab & "<td>"
Response.Write rs.Fields(I)
If (rs.Fields(I) = "") or isNull(rs.Fields
(I)) then
Response.Write " "
Else
Response.Write "</td>" & vbCrLf
End If
Next 'I
Response.Write vbTab & "</tr>" & vbCrLf
' Can't forget to move to the next record!
rs.MoveNext
Loop
' All done - close table
Response.Write "</table>" & vbCrLf
' Close DB objects and free variables
rs.Close
Set rs = Nothing
db.Close
Set db = Nothing
' END RUNTIME CODE
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
<meta name="Microsoft Theme" content="indust 101, default">
<meta name="Microsoft Border" content="none">
</head>
<body></body>
</html>
Thanks,
Mel