Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 28th, 2004, 10:07 PM
Authorized User
 
Join Date: Jun 2003
Posts: 90
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to tdaustin Send a message via Yahoo to tdaustin
Default Saving Excel File

Hi Everyone,

I have create a dynamic asp page that converts a recordset of an asp page to excel and then enforces the download using aspSmartUpload component. How ever i have run into a problem.

The download starts before all the records have been loaded. So for example i only get the first 5 - 6 records saved to the excel file.

How can make it wait until all the records have been loaded? or is there a beter way to convert a recordset to excel and enforce to be saved on the users pc.

Code:
Code for excel.asp page
<%
Response.Buffer = true
%>




<% 
' Tells the browser to open excel
Response.ContentType = "application/vnd.ms-excel"
strSQL = "SELECT * FROM tblGoodsInterest WHERE GoodsID = 110 ORDER BY InterestID DESC"
Set objRS = Server.CreateObject("ADODB.Recordset")
      objRS.Open strSQL, objConn, adOpenStatic, adLockReadOnly, adCmdText
%>
<html>
<body>
<table width="100%"  border="1" cellpadding="0" cellspacing="1" bgcolor="#EBEBEB">
      <tr bgcolor="#FFFFFF">
        <td width="185">Company Name </td>
        <td width="150"><div align="center">Aus Man </div></td>
        <td width="150"><div align="center">Aus Emp </div></td>
        <td width="150" >Location</td>
        <td width="150" >Contact Person </td>
        <td width="150">Contact Number </td>
        <td width="150">Email</td>
        <td width="150" >Website</td>
        <td width="150" >Date</td>
        <td width="150"><div align="center" class="style1">Bid Status </div></td>
      </tr>
      <%

      Do While Not objRS.EOF

      %>
      <tr bgcolor="#FFFFFF">
        <td class="style4"><%= objRS("CompanyName") %>
        </td>
        <td><div align="center"><%= objRS("AusMan") %></div></td>
        <td><div align="center"><%= objRS("AusEmp") %></div></td>
        <td ><%= objRS("Location") %></td>
        <td><%= objRS("ContactName") %></td>
        <td><%= objRS("ContactNumber") %></td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td >&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <% 

      objRS.MoveNext
      Loop
     objRS.Close
     Set objRS = Nothing

      %>
    </table>
    <%

'  Variables
'  *********
   Dim mySmartUpload
    '  Object creation
'  ***************
   Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")

'  Download
'  ********
   Call mySmartUpload.DownloadFile"/excelapp/excel.asp","application/vnd.ms-excel","Registrations.xls")


%>
</body>
</html>
TDA
__________________
TDA
 
Old June 28th, 2004, 10:48 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

I have not used aspSmartUpload component in my case, Instead, I have used FileSystemObject to Store the data(TAB separated) into CSV files and provide a link to that file, which lets the user download. This works fine and never found the files having lesser number of rows than expected. That anyways can be opened using excel and one doesn't lose the columns/rows formatting.

Seems you are trying the Download code from within excel.asp? Why don't you try that from outside the excel.asp file?

Cheers!

_________________________
- Vijay G
Strive for Perfection
 
Old June 29th, 2004, 09:30 PM
Authorized User
 
Join Date: Jun 2003
Posts: 90
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to tdaustin Send a message via Yahoo to tdaustin
Default

Thanks,

I originally converted to csv, except i couldnt format the cell widths ect. Is it possible pass formatting properties in CSV?

If so could you maybe post a sample you have done

Thanks

Tim

TDA
 
Old June 29th, 2004, 09:38 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

I haven't heard of passing formatting properties for CSV. Anyways cells are resizable in excel, that shouldn't be a problem then.

Cheers!

_________________________
- Vijay G
Strive for Perfection
 
Old June 30th, 2004, 04:54 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 344
Thanks: 0
Thanked 1 Time in 1 Post
Default

check out http://www.greggriffiths.org/webdev/both/excel/ which covers some approaches to this.
 
Old June 30th, 2004, 08:17 PM
Authorized User
 
Join Date: Jun 2003
Posts: 90
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to tdaustin Send a message via Yahoo to tdaustin
Default

Thanks Guys,

I decided to go back to the CSV. I found performance was better and CSV hassle free. I found a really good approach @
http://www.devx.com/getHelpOn/10%20M...Solution/20482

Cheers

Tim

TDA
 
Old December 2nd, 2006, 03:38 AM
Registered User
 
Join Date: Dec 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi all,

I am facing similar problem, except I am creating and downloading a .DBF (dbase) file throuhg my asp page using aspsmartupload component.
my problem is my application creates the DBF on server successfully but it is not download it on server properly. when i try to open the downloaded file on client machine, it does not open it in proper format. it shows some ascii text in that. however when i try to open dbf on server in excel, it opens that file in a proper dbf format like in rows & column structure.

Please help me out, what could be the reason of this problem and what is the solution for this.

please reply ASAP. send ur reply to [email protected].

Thanks






Similar Threads
Thread Thread Starter Forum Replies Last Post
Saving with Excel VBA Scooter057 Excel VBA 1 January 15th, 2008 10:33 PM
Saving results as Excel chrscote Classic ASP Databases 3 August 9th, 2007 05:56 PM
Need help AFTER saving an Excel File amerk20 Excel VBA 5 January 8th, 2007 01:42 PM
Saving an excel file in Access VBA theboylatham Access VBA 1 August 19th, 2005 08:14 AM
EXCEL question saving a file saving the the first macupryk VS.NET 2002/2003 0 January 6th, 2005 05:33 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.