You must limit the number of rows in your Sql, for example ...
SELECT TOP 10000 * FROM SomeTable;
if you do not, and you have 1.8M in your request, then there is no system capable of handling it.
But this will force your application to process only the first 10,000 rows ... if you need to process all the rows, then you must repeat the execution of this sql block, there are no more rows ... for example
public IoSqlReply GetResultSet(String directoryName, String userId, String password, String sql) { IoSqlReply ioSqlReply = new IoSqlReply(); DataTable dtResultSet = new DataTable(); IoMsSQL ioMsSQL = null; bool keepProcessing = true; try { using (OdbcConnection conn = new OdbcConnection(cs)) { conn.Open(); while (keepProcessing) { using (OdbcCommand cmd = new OdbcCommand(sql, conn)) { using (OdbcDataReader reader = cmd.ExecuteReader()) { if (reader.HasRows) { for (int col = 0; col < reader.FieldCount; col++) { String colName = reader.GetName(col); String colDataType = reader.GetFieldType(col).ToString(); ; dtResultSet.Columns.Add(reader.GetName(col), reader.GetFieldType(col)); }
This is a very crude example ... It can be improved, but I think it is an easy solution to your problem.
source share