JAYRAM

JAYRAM

  • NA
  • 272
  • 213.9k

read excel coloum value in datatable

Jan 6 2015 1:21 AM
How to add excel coloum value in datatable 
 
 i have excel like below
 
sno     name        
1         raju
2        vamshi 
 3      fgh
and  add date field  in every colum as "jan14"  
 i am using below query ....but how to write date fied affected in all coloums
 
 
Query = string.Format("Select [sno],[name] FROM [{0}]", "Sheet1$");
OleDbCommand Ecom = new OleDbCommand(Query, OleDbcon);
OleDbcon.Open();
DataSet ds = new DataSet();
OleDbDataAdapter oda = new OleDbDataAdapter(Query, OleDbcon);
OleDbcon.Close();
oda.Fill(ds);
DataTable Exceldt = ds.Tables[0];
SqlBulkCopy objbulk = new SqlBulkCopy(conn);
 

Answers (4)