Code: Select all
SELECT id, name
FROM tbl_foo
ORDER BY name
LIMIT 10 OFFSET 0;
When I load the results of this query into a PgSqlDataTable using Load(PgSqlDataReader) the rows are not being loaded in the correct order.
I have tried looping through the results in the DataReader myself using Read() and the row order is still wrong, so I don't think it has anything to do with the DataTable.
Why isn't the row order being maintained by the DataReader?
Edit: I should note that I'm using the latest version of dotConnect for PostgreSQL (4.55.39).
The C# code for this is very straight forward:
Code: Select all
using (PgSqlConnection conn = new PgSqlConnection(connString)) {
PgSqlCommand cmd = new PgSqlCommand(query, conn);
conn.Open();
DataTable dt = new DataTable();
dt.Load(cmd.ExecuteReader());
}
dgGrid.DataSource = dt;
dgGrid.DataBind();