Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Best way to perform numerous calculations on data from asp.net webpage -- updated with more info

Posted on 2012-04-04
3
Medium Priority
?
188 Views
Last Modified: 2012-06-21
Afternoon All,

My current website project will be created from VS2010Express C#.  
Step 1 would be to read excel contents from users pc, done by using OleDB to Read Excel
         
The goal is to perform numerous and extensive statistic/financial  calculations on this data.  Based on all the calculations I perform the end result is showing charts and statistics on website.

So far the data is in a dataset.  In terms of funtionality... I'm looking to search through rows/columns for specific items... add columns... grab certain rows or columns....
what would offer more functionality for me.  Doing all my calculations from a datatable... or transferring to an array and doing calc there??

appreciate everyones advice and as I'm sure you can tell I'm pretty new to this

thanks
0
Comment
Question by:solarissf
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 23

Accepted Solution

by:
Christopher Kile earned 2000 total points
ID: 37814143
You want to read an Excel workbook from your client's workstation, perform calculations using its data, then display the results?  This can be done.  It can't all be done on the client workstation, however, without processing the workbook file as XML, and this is not always possible (earlier versions didn't store workbooks as .DOCX).  The best and most consistent way of doing this is to upload the workbook to your server, process the caluclation there, then return the results in a new Web page.  Does this sound like what you might want to do?
0
 

Author Comment

by:solarissf
ID: 37814352
Yes, I do want to read an excel workbook from a user logging into my website.  I think I have this part successfully done by using the below code.

Unfortunately I do not know what XML is.  Based on how I think this works is based on the below code I have already stripped the users excel sheet and now have the info in my dataset.  Which I was planning on putting in a datatable to run my calculations.  Is there anything wrong with my plan of attack?



using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Data;

using System.Data.OleDb;

 

public partial class _Default : System.Web.UI.Page

{

    protected void Page_Load(object sender, EventArgs e)

    {

        string path =@"C:\Documents and Settings\sforero\Desktop\peer.xlsm";

        string connstr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + ";Extended Properties=Excel 12.0;"; 

        //string strConn = "Provider= Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + path + "; " + "Extended Properties=Excel 8.0;";

        OleDbConnection conn = new OleDbConnection(connstr);

        string strSQL = "select * from [Data$]";

        OleDbCommand cmd = new OleDbCommand(strSQL, conn);

        DataSet ds = new DataSet();

        OleDbDataAdapter da = new OleDbDataAdapter(cmd);

        da.Fill(ds);

        GridView1.DataSource = ds;

        GridView1.DataBind();

 

 

Open in new window

0
 
LVL 23

Expert Comment

by:Christopher Kile
ID: 37823658
Sorry for the delay in getting back to you, but you certainly took my suggestion and ran with it.  Glad it worked for you, and thanks for the points.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question