Reputation: 13
When i select records from excelsheet the datatable is sorted. I want the records in same sequence as excelsheet, why is the datatable sorted.
OleDbCommand objCommand = new OleDbCommand("SELECT distinct * FROM [" + strSheet + "]", objXConn);
OleDbDataAdapter objAdapter = new OleDbDataAdapter(objCommand);
objAdapter.Fill(dtEx);
Upvotes: 0
Views: 188
Reputation: 13
It was taking the first column datatype as Numeric. i added the IMEX=1 in extended properties, now since the column is treated as string the data is not sorted anymore.
Thanks
Upvotes: 0