Solved

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

Posted on 2012-04-04
3
180 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
  • 2
3 Comments
 
LVL 23

Accepted Solution

by:
Christopher Kile earned 500 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Introduction This Article is a follow-up to my Mappit! Addin Article (http://www.experts-exchange.com/A_2613.html), it was inspired by an email posting I made to EUSPRIG (http://www.eusprig.org/index.htm), I will briefly cover: 1) An overvieā€¦
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
Viewers will learn the basics of slicers and timelines for both PivotTables and standard Excel tables in Excel 2013.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

757 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now