c# - SQL ODBC adapter out of memory exception -


i connecting , receiving data ibm's series as400 database, using odbc adapters , dataset.

i have odbc connection given below:

odbccommand cmd = new odbccommand(querystring, conn);           // set active query odbcdataadapter rt = new odbcdataadapter(querystring, conn);    // active data transfer dataset ds = new dataset();                                     // create dataset rt.selectcommand.commandtimeout = 180;                          // set command timeout rt.fill(ds);                                                    // transfer data var reader = ds.createdatareader();                             // create reader reader.read();                                                  // read while (reader.read()) { ... } 

and strangely gives system.outofmemoryexception on line rt.fill(ds);

if there 1billion rows 130 columns cause error?

how can avoid error , recieve data want?

if there 1billion rows 130 columns cause error?

that seems lot of data , cause error.

how can avoid error , recieve data want?

you should use datareader directly, bypassing dataset. if this, datareader load 1 row of data, getting next row when call read.

odbccommand cmd = new odbccommand(querystring, conn); // set active query conn.open();                          // may not need if open var reader = cmd.executereader();     // create reader while (reader.read()) { ... }         // process records, 1 @ time reader.close();                       // close reader after use 

more info:

odbcdatareader class @ msdn

contrasting ado.net datareader , dataset


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -