Last post Aug 16, 2016 04:36 AM by Yohann Lu
Aug 02, 2016 06:17 AM|wikisid|LINK
Hi , I got Memory out Of Exception while download bulk reports . So i alter the code by using DATAREADER instead of DATASET .
How to achieve below code in DataReader because am helpless to use any datatables & dataset in my coding.
if (dataSet.Tables.Rows[i + 1]["Sr No"].ToString() == dataSet.Tables.Rows[i]["Sr No"].ToString())
Aug 02, 2016 07:10 AM|Mikesdotnetting|LINK
You can't access a specific row like that when using a DataReader as it only provides forward-only access to its contents. You can do this:
//do something with rdr["Sr No"].ToString();
Aug 02, 2016 07:16 AM|wikisid|LINK
I can achieve this only in dataset or datatable but am getting Memory out of exception
How to solve the issue .
Aug 02, 2016 08:30 AM|Mikesdotnetting|LINK
Reduce the amount of data you are retrieving or add more memory.
Aug 16, 2016 04:36 AM|Yohann Lu|LINK
You can try to set the DataReader to use SequentialAccess.
The sequential access is typically used for large binary data, based on the MSDN documentation you can use it to read large amounts of character data as well.
You can also try to create an SP and run that on the server side, spares you direct a bunch of memory. Refer the following forum and get a suitable help.
SQL Server Transact-SQL forum: