469,626 Members | 1,336 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,626 developers. It's quick & easy.

Creating an MDB/XLS file

A.M
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 inside a .NET
program?

Thanks,
Ali
Nov 17 '05 #1
3 1728
Excel has an OLEDB provider.
It's pretty easy to extract data from SQL to Excel.

http://www.winisp.net/cheeso/srcview...ractToExcel.cs
You should not try to use Office automation from a server app.
There's a KB article that describes why.

-Dino

--
Dino Chiesa
Microsoft Developer Division
d i n o c h @ o n l i n e . m i c r o s o f t . c o m
"A.M" <IH*******@sapm123.com> wrote in message
news:Oj*************@TK2MSFTNGP10.phx.gbl...
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 inside a .NET
program?

Thanks,
Ali

Nov 17 '05 #2
Hi Ali,

Firstly I want to thank Dino for his great help in this issue. Please check
his response carefully.

In addition, the following article is what Dino has mentioned in his post.

INFO: Considerations for Server-Side Automation of Office
http://support.microsoft.com/default...b;en-us;257757
"...
Microsoft does not currently recommend, and does not support, Automation of
Microsoft Office applications from any unattended, non-interactive client
application or component (including ASP, DCOM, and NT Services), because
Office may exhibit unstable behavior and/or deadlock when run in this
environment.
..."

I hope it helps.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 17 '05 #3
I'd drop the idea of creating an MDB.

But on the excel side, you don't have to using office automation to "create"
an excel spreadsheet. Excel know how to parse HTML tables, so you can
create a spreadsheet that way.

Response.Clear()
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader("Content-Disposition", "filename=" + "calculations.xls")
Response.write("<table><tr><th>Data</th><td>2</td></tr></table>")
Response.End

If you are using VS.NET make sure to remove everything from the .aspx file
except for the <% @Page ...%> directive.

Don't change the name of the page from .aspx! That is handled by the
Content-Disposition header

If you provide a link to this page, the user will be prompted to download
the .xls file or open it in Excel.

If you need actual formulas and stuff in the spreadsheet, you'll have to do
some experimenting. Don't know if that can be done.


"A.M" <IH*******@sapm123.com> wrote in message
news:Oj*************@TK2MSFTNGP10.phx.gbl...
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 inside a .NET
program?

Thanks,
Ali

Nov 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Jeremy Langworthy | last post: by
1 post views Thread by Inpreet | last post: by
2 posts views Thread by George Marsaglia | last post: by
15 posts views Thread by Carlos Lozano | last post: by
12 posts views Thread by Mats Lycken | last post: by
15 posts views Thread by David Thielen | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.