April 6th, 2010, 06:09 PM
Data Analysis Coding Help
VS 2005 Net 2.0
I'm a student and have been using C# before with VS for class but have yet to use it to make a functional data table.
For the project I'm working on I need a gui where you can upload a csv into a data table, then run an autocalculation that sums and reports the top values by city, which is a field in the csv. Thing is, I'm not really sure where to go with this.
Below is what I have so far. Not sure how close (or far) I am to what I need done; hopefully, I found a forum I can get some help with this stuff.....
public partial class Form1 : Form
private void button1_Click(object sender, EventArgs e)
//OpenFileDialog dialog = new OpenFileDialog();
"csv files (*.csv)|*.csv|All files (*.*)|*.*";
openFileDialog1.Title = "Select a CSV file";
DataView yes = new DataView();
public void setExcelFileAsDataSourceToDataGridView(string FileName)
//Check Whether file is csv file or not
if (Path.GetExtension(FileName) == ".csv")
//Create a OLEDB connection for Excel file
string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" +
"Data Source=" + FileName + ";" + "Extended Properties=Excel 8.0;";
objConn = new OleDbConnection(connectionString);
oleDA = new OleDbDataAdapter("select * from [Sheet1$]", objConn);
ds = new DataSet();
//Fill the Data Set
//Set DataSource of DataGridView
dataGridView1.DataSource = ds.Tables;
catch (Exception ex)
MessageBox.Show("Please select CSV File");
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.