473,386 Members | 1,779 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Help with creating an excel file from a db

I do not get an error, but I also do not get any data in the excel file. I
know it is connecting to the db

<!--#include file="../db.asp"-->
<%

Response.ContentType = "application/vnd.ms-excel"
%>

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<%
OpenDatabase dbc
set objrs = server.createobject("ADODB.Recordset")
SQL = "select * from title"
Set objrs=dbc.execute(SQL)
%>
<TABLE BORDER=1>
<TR>
<%
For i = 0 to objrs.fields.count - 1
%>
<TD><% = objrs(i).name %></TD>
<% next %>
</TR>
<%

while not objrs.eof
%>
<TR>
<% For i = 0 to objrs.fields.count - 1
%>
<TD VALIGN=TOP><% = objrs(i) %></TD>
<% Next %>

</TR>
<%
objrs.MoveNext

wend

%>

<body>

</body>
</html>

Jul 19 '05 #1
3 1344
Dave wrote:
I do not get an error, but I also do not get any data in the excel
file. I know it is connecting to the db

<!--#include file="../db.asp"-->
<%

Response.ContentType = "application/vnd.ms-excel"
%>

If you remove the ContentType line, do you get the expected data in the
resulting page?

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 19 '05 #2
perhaps the output should be between the <body> </body> tags.

"Dave" <da***@helixpoint.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
I do not get an error, but I also do not get any data in the excel file. I
know it is connecting to the db

<!--#include file="../db.asp"-->
<%

Response.ContentType = "application/vnd.ms-excel"
%>

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<%
OpenDatabase dbc
set objrs = server.createobject("ADODB.Recordset")
SQL = "select * from title"
Set objrs=dbc.execute(SQL)
%>
<TABLE BORDER=1>
<TR>
<%
For i = 0 to objrs.fields.count - 1
%>
<TD><% = objrs(i).name %></TD>
<% next %>
</TR>
<%

while not objrs.eof
%>
<TR>
<% For i = 0 to objrs.fields.count - 1
%>
<TD VALIGN=TOP><% = objrs(i) %></TD>
<% Next %>

</TR>
<%
objrs.MoveNext

wend

%>

<body>

</body>
</html>

Jul 19 '05 #3
crap!!!! Thanks
"TomB" <sh*****@hotmailXXX.com> wrote in message
news:Ow**************@TK2MSFTNGP11.phx.gbl...
perhaps the output should be between the <body> </body> tags.

"Dave" <da***@helixpoint.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
I do not get an error, but I also do not get any data in the excel file. I know it is connecting to the db

<!--#include file="../db.asp"-->
<%

Response.ContentType = "application/vnd.ms-excel"
%>

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<%
OpenDatabase dbc
set objrs = server.createobject("ADODB.Recordset")
SQL = "select * from title"
Set objrs=dbc.execute(SQL)
%>
<TABLE BORDER=1>
<TR>
<%
For i = 0 to objrs.fields.count - 1
%>
<TD><% = objrs(i).name %></TD>
<% next %>
</TR>
<%

while not objrs.eof
%>
<TR>
<% For i = 0 to objrs.fields.count - 1
%>
<TD VALIGN=TOP><% = objrs(i) %></TD>
<% Next %>

</TR>
<%
objrs.MoveNext

wend

%>

<body>

</body>
</html>


Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Jeremy Langworthy | last post by:
Hi I am trying to create a MS Excel format CSV but I can't figure out how to get the line feed/carriage return/new record working properly. I am nding each line/record with these characters:...
5
by: Guy Incognito | last post by:
Hello, I've written an asp.net application that creates Excel documents. It works by creating an excel document in XML format. But I wonder if I'm reinventing the wheel. I know that there are...
9
by: Paul | last post by:
Hi all Arggghhh........... The problem.....I want the user to be able to create an excel document and name particular cells in the document where they want the data to be placed and then save...
3
by: A.M | last post by:
Hi, Using ASP.NET/VB.NET and SQL Server backend, I need to return calculation results to user as an Access MDB file or Excel XLS sheet. What would be the best way to create a MDB or XLS file...
2
by: John Saunders | last post by:
Ok, this is what I need to accomplish. We have a huge excel file that comes in daily. I need the server to grab this excel file each day and import the data into a SQL database. Once that is...
1
by: Learner | last post by:
HI Friends, I am brand new to creating Crystal reports. But overcomed a lot of problems and so far happy what i could accomplish, calling a stored proc with a parameter in it. And i can see the...
5
by: joeblue | last post by:
I have the following code in Access 97: Public gobjExcel As Object Public gobjWorkSheet As Object Set gobjExcel = GetObject(, "Excel.Application") If Err.Number Then Set...
7
by: Paul | last post by:
Hi I have created an excel file download feature within a .net application using Microsoft Office XP primary interop assembly for excel. I was just wondering if anyone knows if you can also embed...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.