I'm using following Code for Exporting CSV file contents to DataGridView in C# My Windows application is successfully running. but Not display even Datagridview or anything in Output...
I Don't know where is the exact problem.
My aim is to Display contents of .csv file in datagridview. i hv stored the .csv file in My C Drive.. as specified in path..
can anybody help me.. It's very very Urgent.. for my friend...
Using System.data.Odbc;
namespace finaltry { public partial class Form1 : Form {
private void Form1_Load(object sender, System.EventArgs e)
{
string ConnectionString = @"Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=c:\;Extensions=asc,csv,tab,txt";
OdbcConnection conn = new OdbcConnection(ConnectionString);
try
{
conn.Open();
OdbcDataAdapter da = new OdbcDataAdapter("Select * FROM SharedIncidents.csv", conn);
DataSet ds = new DataSet();
da.Fill(ds, "SharedIncidents");
dataGridView1.DataSource = ds.DefaultViewManager;
conn.Close();
}
catch (System.Exception)
{
MessageBox.Show("error is" );
}
}
}
}
My application is running successfuly... bt not showing anything in datagridview.. can any1 tell me where is the exact prb.. ??