Question on exporting data from a database using ASP.

B

Brave

I don't know if this is possible, but I have been amazed at what I have
learned from this group so I will throw it out there.

I have an MS Access database that I connect to through .asp pages. Can
I offer a user of my page the ability to export data from the Access
database (either feeding of a table or a query) to their hardrive in an
Excel format?

If it is possible, I have two followup questions.

1: Can you export in additional formats (Access, Word, Notepad, ...)?

2: Can you do this if connecting to a SQL server?

Thanks.
 
B

Bob Barrows [MVP]

Brave said:
I don't know if this is possible, but I have been amazed at what I
have learned from this group so I will throw it out there.

I have an MS Access database that I connect to through .asp pages. Can
I offer a user of my page the ability to export data from the Access
database (either feeding of a table or a query) to their hardrive in
an Excel format?

If it is possible, I have two followup questions.

1: Can you export in additional formats (Access, Word, Notepad, ...)?

2: Can you do this if connecting to a SQL server?
It is possible, but probably not in the fully automated way you are
envisioning. ASP operates in an http environment, which means that it has no
access to a user's hard drive. It will be up to the user to decide if and
where they wish to save any file you send to them. To see what I'm talking
about, put an excel file in one of your websites and browse to it. See the
prompts? There is no way to eliminate those prompts.

The other consideration is file size. You will probably want to limit the
size of the file to be streamed to the client.

The approach you will likely take is to set the Response.ContentType to the
appropriate mime setting, open a recordset and write its contents to
Response. These articles can get you started:

http://support.microsoft.com/kb/199841/
http://support.microsoft.com/kb/288130/

http://support.microsoft.com/kb/270906/
http://support.microsoft.com/kb/260239/
 
B

Brave

Thanks so much for taking the time.

envisioning. ASP operates in an http environment, which means that it has no
access to a user's hard drive. It will be up to the user to decide if and
where they wish to save any file you send to them. To see what I'm talking
about, put an excel file in one of your websites and browse to it. See the
prompts? There is no way to eliminate those prompts.

The other consideration is file size. You will probably want to limit the
size of the file to be streamed to the client.

The approach you will likely take is to set the Response.ContentType to the
appropriate mime setting, open a recordset and write its contents to
Response. These articles can get you started:

http://support.microsoft.com/kb/199841/http://support.microsoft.com/kb/288130/

http://support.microsoft.com/kb/270906/http://support.microsoft.com/kb/260239/

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top