Wrox Programmer Forums
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. 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 Databases 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 October 16th, 2003, 11:51 AM
Authorized User
Join Date: Jul 2003
Posts: 41
Thanks: 0
Thanked 1 Time in 1 Post
Default download db data to .xls with asp

I found a script to create a comma delimited spreadsheet. I have 2 problems with it. Help if you can.

1. It will save the object as a .asp file unless you rename it. How do I tell it the file is to have the extension .xls
2. It's a comma delimited file...we have comma's in our DB. I need to know how to change it to tab delimited or something like that.

the code:

' prepare MS ACCESS connection
Dim connect, rs
Dim sSQL, Conn

Set connect = Server.CreateObject("ADODB.Connection")
Set rs = Server.CreateOBject("ADODB.Recordset")
connect.ConnectionString = _
  "Provider=Microsoft.Jet.OLEDB.4.0;" & _
  "Data Source=" & sDataSource

    sSQL = "SELECT * " & _
           " FROM MasterTableCfoapal2"
    set rs = Connect.Execute(sSQL)

Dim F, Head
For Each F In rs.Fields
  Head = Head & ", " & F.Name
Head = Mid(Head,3) & vbCrLf
Response.ContentType = "text/plain"
Response.Write Head
Response.Write rs.GetString(,,", ",vbCrLf,"")

Old October 16th, 2003, 06:17 PM
Friend of Wrox
Join Date: Jun 2003
Posts: 344
Thanks: 0
Thanked 1 Time in 1 Post

check out http://www.greggriffiths.org/webdev/both/excel/ for some sample approaches to this issue.
Old October 17th, 2003, 02:18 PM
Authorized User
Join Date: Jul 2003
Posts: 41
Thanks: 0
Thanked 1 Time in 1 Post

Thanks Greg

Similar Threads
Thread Thread Starter Forum Replies Last Post
Export data into the xls Sheet Directly without cl Kali Charan Tripathi Reporting Services 0 October 9th, 2008 06:40 AM
Unable to download sample codes Beginning ASP Data ckm2003 Wrox Book Feedback 1 November 2nd, 2007 07:56 AM
transfer data to xls with ADO not working nebbish Access 4 March 1st, 2006 09:55 PM
Secure MSAccess db ASP Data Page Integration Will Woodward Classic ASP Databases 1 October 26th, 2005 08:32 AM
Pulling data from an Access DB onto an ASP page Melissa Brown Classic ASP Databases 7 August 6th, 2004 09:16 PM

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