views:

10

answers:

1

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);

A: 

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

NaiveProgrammer