I am trying searching a value on column "C" and getting a matched cell name as well, for example C14, now how can I select the values in row 14. I tried as :
private static MyObject GetRowValue(int rowNumber)
{
string connString = "";
string path = "C:\\Code\\MyFile.xls";
connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + path + ";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=2\"";
string query = "SELECT * FROM [Sheet1$A" + rowNumber + ":BD" + rowNumber + "]";
using (OleDbConnection connection = new OleDbConnection(connString))
{
var adapter = new OleDbDataAdapter(query, connection);
DataSet ds = new DataSet();
adapter.Fill(ds);
DataTable dt = ds.Tables[0];
}
}
If row number is 10, them I am trying to get all values of 10th row only, but it is returning all the rows after 10th row.