Solved

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

Posted on 2012-04-04
3
187 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 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

615 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