×

Loading...
Ad by
Ad by

Not sure what you mean 'Office Web Components'.

If you mean MS office automation, it’s better not to use. There are Considerations for server-side Automation of Office (URL http://support.microsoft.com/kb/257757).

If your excel file will be used for client-side, you can pull data from database and put data to a GridView. Then use GridView.RenderControl to get a grid string (By google Export GridView to Excel, you can get many codes).

Or on server-side, you can use OleDb to deal with Excel file as database. From following URL you can have Connection String for excel:
http://www.connectionstrings.com/?carrier=excel
Report

Replies, comments and Discussions:

  • 工作学习 / 学科技术讨论 / 请大家帮帮忙,先谢了! 新上手 ASP.NET/C# ,不熟, 下周五要交差,tasks见内。
    Website 是一个交易平台,

    database : MS SQL Server
    - using Microsoft.Practices.EnterpriseLibrary.Data with stored procedure to query (existing code,maybe i can change it...)
    - put query results to a Excel sheet (怎样在 EnterpriseLibrary.Data 中把 query results 放到 Excel file 里去?能不能用 Office Web Components ?)
    - mail this Excel file to users weekly (how to schedule a task on the server side for this requirment? which technology should I use? Better not use a new apps for the scheduling)

    谢谢各位指教!
    • Not sure what you mean 'Office Web Components'.
      If you mean MS office automation, it’s better not to use. There are Considerations for server-side Automation of Office (URL http://support.microsoft.com/kb/257757).

      If your excel file will be used for client-side, you can pull data from database and put data to a GridView. Then use GridView.RenderControl to get a grid string (By google Export GridView to Excel, you can get many codes).

      Or on server-side, you can use OleDb to deal with Excel file as database. From following URL you can have Connection String for excel:
      http://www.connectionstrings.com/?carrier=excel
      • OWC can do that.
        • LZ asked to put query results to a Excel sheet rather than publishing spreadsheets to the Web.
          • you are right, I need to put the query result to Excel sheet directly and mail the file as a attachment.
            • In addtion to approaches I mentioned before, You can also 'write' data rows to execl by using XML format excel.
    • I guess you should not finish it in time without help.
      • 是不是我要对manager说我需要多一点的时间?我不知道我能不能得到其他的帮助,因为我刚去这家公司上班。
        • 想问问面试技巧,不熟怎么能通过面试的。请PM,谢谢!我也在找工作中。
          • 申请时不是ASP.NET /C#position,去了之后让做ASP.NET /C#就答应了,以前自己看过一点但没有hands-on 经验。面试时问了我以前的工作经验加考试。
    • 谢谢大家的的回复。
    • do you have to use ASP.NET? need to input some query parameter from web page? if not you can just use c# to write some program to generate a EXE and called from windows CRON job.
      • i have found a way to do it, thanks a lot.
    • with SSRS, it should be piece of cake?
    • 再次感谢大家的指导和回复!
      不好意思,2~3年没写code了,不过我想过几个月就会慢慢熟悉coding了,我已在周四晚上完成了这个task,再次感谢大家的指导和回复!