Microsoft Disillusion

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am struggling to export Excel spreadsheets to the client machine in an
ASP.Net application. Everything was great until exporting Excel got into the
act. Documentation on MSDN is so poor regarding this subject it is pathetic.
Following examples on MSDN lead me to using CreateObject("Excel.Application")
which of course bombs in .Net! I finally discovered the
Microsoft.Office.Interop.Excel object and thought my problems were over.

When I got to "Dim xls As New Microsoft.Office.Interop.Excel.Application"
ASP.Net abruptly threw another error saying the ASPNET user account didn't
have permission to use my new found resource. Looking in the User folder I
can't even find ASPNET as a user. (I am strictly a developer and don't know
Shinola about network administrator type duties). My platform is Windows
Small Business Server 2003. Maybe I'm not supposed to be developing on this?

I am an independent contractor and the extent of my frustration and anger at
Microsoft at this stage of the game is immense!

I am also a Certified Partner who can't get any direct help from the
bureaucracy. What a waste of money dealing with Microsoft.

Is there anybody out there who can help me solve this problem? I am at the
end of my rope. My client has been waiting almost a month for my final
version of this thing and I am no closer to a solution than in the beginning.

Maybe I should just scrap everything and learn Java. Are you listening
Ballmer?

How can something so simple become so difficult?

Frank Fox
(e-mail address removed)
 
Frank,

You need to look at querying the excel sheet with System.Data.OleDB namespace

Something like...

Dim DS As System.Data.DataSet
Dim MyCommand As System.Data.OleDb.OleDbDataAdapter
Dim MyConnection As System.Data.OleDb.OleDbConnection

MyConnection = New System.Data.OleDb.OleDbConnection( _
"provider=Microsoft.Jet.OLEDB.4.0; " & _
"data source=C:\myData.XLS; " & _
"Extended Properties=Excel 8.0;")
' Select the data from Sheet1 of the workbook.
MyCommand = New System.Data.OleDb.OleDbDataAdapter( _
"select * from [Sheet1$]", MyConnection)

DS = New System.Data.DataSet()
MyCommand.Fill(DS)
MyConnection.Close()
 
Chris,

Thanks for the thoughtful reply. You put some effort into this and I
appreciate it.
I can't even create an Excel object let alone query it after birth.

This weird "access denied" message has me beat.

Thanks again.

Frank

chrisrock said:
Frank,

You need to look at querying the excel sheet with System.Data.OleDB namespace

Something like...

Dim DS As System.Data.DataSet
Dim MyCommand As System.Data.OleDb.OleDbDataAdapter
Dim MyConnection As System.Data.OleDb.OleDbConnection

MyConnection = New System.Data.OleDb.OleDbConnection( _
"provider=Microsoft.Jet.OLEDB.4.0; " & _
"data source=C:\myData.XLS; " & _
"Extended Properties=Excel 8.0;")
' Select the data from Sheet1 of the workbook.
MyCommand = New System.Data.OleDb.OleDbDataAdapter( _
"select * from [Sheet1$]", MyConnection)

DS = New System.Data.DataSet()
MyCommand.Fill(DS)
MyConnection.Close()



frankvfox said:
I am struggling to export Excel spreadsheets to the client machine in an
ASP.Net application. Everything was great until exporting Excel got into the
act. Documentation on MSDN is so poor regarding this subject it is pathetic.
Following examples on MSDN lead me to using CreateObject("Excel.Application")
which of course bombs in .Net! I finally discovered the
Microsoft.Office.Interop.Excel object and thought my problems were over.

When I got to "Dim xls As New Microsoft.Office.Interop.Excel.Application"
ASP.Net abruptly threw another error saying the ASPNET user account didn't
have permission to use my new found resource. Looking in the User folder I
can't even find ASPNET as a user. (I am strictly a developer and don't know
Shinola about network administrator type duties). My platform is Windows
Small Business Server 2003. Maybe I'm not supposed to be developing on this?

I am an independent contractor and the extent of my frustration and anger at
Microsoft at this stage of the game is immense!

I am also a Certified Partner who can't get any direct help from the
bureaucracy. What a waste of money dealing with Microsoft.

Is there anybody out there who can help me solve this problem? I am at the
end of my rope. My client has been waiting almost a month for my final
version of this thing and I am no closer to a solution than in the beginning.

Maybe I should just scrap everything and learn Java. Are you listening
Ballmer?

How can something so simple become so difficult?

Frank Fox
(e-mail address removed)
 
What is the full exception error?

exception.tostring() ?

frankvfox said:
Chris,

Thanks for the thoughtful reply. You put some effort into this and I
appreciate it.
I can't even create an Excel object let alone query it after birth.

This weird "access denied" message has me beat.

Thanks again.

Frank

chrisrock said:
Frank,

You need to look at querying the excel sheet with System.Data.OleDB namespace

Something like...

Dim DS As System.Data.DataSet
Dim MyCommand As System.Data.OleDb.OleDbDataAdapter
Dim MyConnection As System.Data.OleDb.OleDbConnection

MyConnection = New System.Data.OleDb.OleDbConnection( _
"provider=Microsoft.Jet.OLEDB.4.0; " & _
"data source=C:\myData.XLS; " & _
"Extended Properties=Excel 8.0;")
' Select the data from Sheet1 of the workbook.
MyCommand = New System.Data.OleDb.OleDbDataAdapter( _
"select * from [Sheet1$]", MyConnection)

DS = New System.Data.DataSet()
MyCommand.Fill(DS)
MyConnection.Close()



frankvfox said:
I am struggling to export Excel spreadsheets to the client machine in an
ASP.Net application. Everything was great until exporting Excel got into the
act. Documentation on MSDN is so poor regarding this subject it is pathetic.
Following examples on MSDN lead me to using CreateObject("Excel.Application")
which of course bombs in .Net! I finally discovered the
Microsoft.Office.Interop.Excel object and thought my problems were over.

When I got to "Dim xls As New Microsoft.Office.Interop.Excel.Application"
ASP.Net abruptly threw another error saying the ASPNET user account didn't
have permission to use my new found resource. Looking in the User folder I
can't even find ASPNET as a user. (I am strictly a developer and don't know
Shinola about network administrator type duties). My platform is Windows
Small Business Server 2003. Maybe I'm not supposed to be developing on this?

I am an independent contractor and the extent of my frustration and anger at
Microsoft at this stage of the game is immense!

I am also a Certified Partner who can't get any direct help from the
bureaucracy. What a waste of money dealing with Microsoft.

Is there anybody out there who can help me solve this problem? I am at the
end of my rope. My client has been waiting almost a month for my final
version of this thing and I am no closer to a solution than in the beginning.

Maybe I should just scrap everything and learn Java. Are you listening
Ballmer?

How can something so simple become so difficult?

Frank Fox
(e-mail address removed)
 
Amigo, you're a Certified Partner. You can go right to the source. Did you
misfile the materials you got from Microsoft telling you how to open an
incident with MS under your partnership agreement?

I'm just a regular old everyday MSDN Universal subscriber and I can do this
by just picking up the telephone, up to four times a year, and I get all the
way in to the development team when I need to, and they keep calling me back
until we solve my problem. You can too once you get off your high horse.

Really,
Tom Dacon
Dacon Software Consulting
 
Hi Frank,

The framework is vast, and while the Microsoft documentation is actually
very detailed. However, if you don't know what you are searching for then
finding it in MSDN is frustrating to say the least. The best tip I can give
you is to try Google, this will at a minimum provide you with a better
vocabulary with which to search MSDN. For example I didn't know anything
about your specific challenge. However after searching Google with -
asp.net export excel - I now know a whole lot about it. As a matter of fact
the first hundred or so links take you directly to code examples that you
can download and run.

Your best bet is to run that search. Create a very scaled down, simple
example of what you are trying to do and see if it works. Then if it
doesn't post back here with code. When you post back be sure to make clear
which line of code your application is bombing on and the exact wording of
the error you are getting. Armed with that the people on the group will be
in a much better position to help you. (Many will probably go straight to
Google and search based on the information you would have just provided.)
You also need to be clear on what you are trying to accomplish. Your
description is that you want to "export Excel spreadsheets to the client
machine". Do you mean that you have spreadsheets on the server and you want
to query them for a subset of data and display this data in a web page? Or
are you trying to move an Excel file? Good luck! Ken.
 
frankvfox said:
I am struggling to export Excel spreadsheets to the client machine in an
ASP.Net application. Everything was great until exporting Excel got into the
act. Documentation on MSDN is so poor regarding this subject it is pathetic.
Following examples on MSDN lead me to using CreateObject("Excel.Application")
which of course bombs in .Net! I finally discovered the
Microsoft.Office.Interop.Excel object and thought my problems were over.

When I got to "Dim xls As New Microsoft.Office.Interop.Excel.Application"
ASP.Net abruptly threw another error saying the ASPNET user account didn't
have permission to use my new found resource. Looking in the User folder I
can't even find ASPNET as a user. (I am strictly a developer and don't know
Shinola about network administrator type duties). My platform is Windows
Small Business Server 2003. Maybe I'm not supposed to be developing on this?

I am an independent contractor and the extent of my frustration and anger at
Microsoft at this stage of the game is immense!

I am also a Certified Partner who can't get any direct help from the
bureaucracy. What a waste of money dealing with Microsoft.

Is there anybody out there who can help me solve this problem? I am at the
end of my rope. My client has been waiting almost a month for my final
version of this thing and I am no closer to a solution than in the beginning.

Maybe I should just scrap everything and learn Java. Are you listening
Ballmer?

How can something so simple become so difficult?

Frank Fox
(e-mail address removed)

http://www.codeproject.com/csharp/csharp_excel.asp
 
¤ Chris,
¤
¤ Thanks for the thoughtful reply. You put some effort into this and I
¤ appreciate it.
¤ I can't even create an Excel object let alone query it after birth.
¤
¤ This weird "access denied" message has me beat.
¤

It's a permissions issue. Depending upon the type of authentication you are using (if any) for your
web application it's likely the account (probably ASPNET) does not have sufficient access to the
file resource/folder.

In addition, I would discourage any attempts to use Office applications via automation on the server
side. See the following:

INFO: Considerations for Server-Side Automation of Office
http://support.microsoft.com/default.aspx?scid=kb;en-us;257757


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
Hi Frank,

I believe your issue has to do with the IIS setup in your machine. There
are two distinct user permission groups which should concern you:

ASPNetUser ( IUser)

:

Choose Start ->Control Panel->Administrative Tools->Internet Information
Services (IIS)

Exapand the tree view and locate the folder where your application resides.
->Right Click Choose Properties
->Choose Directory Securities
->Choose Edit
->check box "Anonymous Access" Click Browse
in the next pop up window Choose "Advanced"
in the next pop up (select User) window, click "Find Now"
In the open window there should appear a list of "Users" on your computer's
iis system, one of those users is "IUSR_Machine Name"
Highlight that user and click "OK"
Continue to click OK until you are back to only the IIS Window.

If you have further problems with this, feel free to email me.
(e-mail address removed)
 
Back
Top