Hello All,
I am the Beginner in C#. i want to read Excel file. in Excel file read based on the key Vale(key value means one column). Please Help me.
Thanks in Advance..
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
LaxmikantPosted Dec 9, 2014, 7:15 AM
see below article which will help you to get excelsheet data in datatable using OleDBConnection
http://dotnetmentors.com/aspnet/display-excel-data-in-web-page.aspx
Candy BrownPosted Dec 9, 2014, 4:22 AM
The code comes from this .NET component that can process excel files.
Vasu GadhiyaPosted Jul 28, 2014, 4:34 AM
try
{
con.Open();
string query = "select * from [Sheet1$]";
OleDbDataAdapter mycommand = new OleDbDataAdapter(query, con);
DataSet ds = new DataSet();
mycommand.Fill(ds, "Table");
dataGridView1.DataSource = ds.Tables[0];
}catch (Exception ex)
{
MessageBox.Show(ex.Source);
}finally
{
con.Close();
}-------------------------------------
to read by column change query list column name select statement.
like
Select id, name from [Sheet1$]
-------------------------------------