Quantcast
Viewing all articles
Browse latest Browse all 12583

OutOf Memory Exception

Now I m running the window application loading the large amount of data and extracting those data and saving back to the Database.

The data amount is too large. That is why, I follow the below approach.

EXEC [dbo].FH_PackageCreate 576753,'PK1ABS95',95,'AUTO','Cairo Flight Stay Package',3,1,'','','ABS','CAI','EG','12/10/2012 12:04:54 PM','12/1/2014 12:04:54 PM','12/10/2012 12:04:54 PM','12/31/2014 12:04:54 PM',1,0,0,95,48,1,1,0,0,72,10,'AED',4,'MS',0,1,123,'',157,0,0,1,'V',860.0000,0,0,'CAI','',1
EXEC [dbo].FH_PackageCreate 576754,'PK1ABS95',95,'AUTO','Hurghada Flight Stay Package',3,1,'','','ABS','HRG','EG','12/10/2012 12:04:54 PM','12/1/2014 12:04:54 PM','12/10/2012 12:04:54 PM','12/31/2014 12:04:54 PM',1,0,0,95,48,1,1,0,0,72,10,'AED',4,'MS',0,1,123,'',157,0,0,1,'V',1250.0000,0,0,'HRG','',1
EXEC [dbo].FH_PackageCreate 576755,'PK1ABS95',95,'AUTO','Luxor Flight Stay Package',3,1,'','','ABS','LXR','EG','12/10/2012 12:04:54 PM','12/1/2014 12:04:54 PM','12/10/2012 12:04:54 PM','12/31/2014 12:04:54 PM',1,0,0,95,48,1,1,0,0,72,10,'AED',4,'MS',0,1,123,'',157,0,0,1,'V',1310.0000,0,0,'LXR','',1
EXEC [dbo].FH_PackageCreate 576756,'PK1ABS95',95,'AUTO','Sharm el Sheikh Flight Stay Package',3,1,'','','ABS','SSH','EG','12/10/2012 12:04:54 PM','12/1/2014 12:04:54 PM','12/10/2012 12:04:54 PM','12/31/2014 12:04:54 PM',1,0,0,95,48,1,1,0,0,72,10,'AED',4,'MS',0,1,123,'',157,0,0,1,'V',1250.0000,0,0,'SSH','',1
EXEC [dbo].FH_PackageCreate 576757,'PK1ABS95',95,'AUTO','Tunis Flight Stay Package',5,1,'','','ABS','TUN','TN','12/10/2012 12:04:54 PM','12/1/2014 12:04:54 PM','12/10/2012 12:04:54 PM','12/31/2014 12:04:54 PM',1,0,0,95,48,1,1,0,0,72,10,'AED',4,'MS',0,1,123,'',157,0,0,1,'V',3530.0000,0,0,'TUN','EK,TK,TU',1
EXEC [dbo].FH_PackageCreate 576758,'PK1ABS95',95,'AUTO','Tunis Flight Stay Package',5,1,'','','ABS','TUN','TN','12/10/2012 12:04:54 PM','12/1/2014 12:04:54 PM','12/10/2012 12:04:54 PM','12/31/2014 12:04:54 PM',1,0,0,95,48,1,1,0,0,72,10,'AED',4,'EK',0,1,123,'',157,0,0,1,'V',3530.0000,0,0,'TUN','MS,TK,TU',1
EXEC [dbo].FH_PackageCreate 576759,'PK1ABS95',95,'AUTO','Tunis Flight Stay Package',5,1,'','','ABS','TUN','TN','12/10/2012 12:04:54 PM','12/1/2014 12:04:54 PM','12/10/2012 12:04:54 PM','12/31/2014 12:04:54 PM',1,0,0,95,48,1,1,0,0,72,10,'AED',4,'TK',0,1,123,'',157,0,0,1,'V',5500.0000,0,0,'TUN','MS,EK,TU',1
EXEC [dbo].FH_PackageCreate 576760,'PK1ABS95',95,'AUTO','Tunis Flight Stay Package',5,1,'','','ABS','TUN','TN','12/10/2012 12:04:54 PM','12/1/2014 12:04:54 PM','12/10/2012 12:04:54 PM','12/31/2014 12:04:54 PM',1,0,0,95,48,1,1,0,0,72,10,'AED',4,'TU',0,1,123,'',157,0,0,1,'V',5500.0000,0,0,'TUN','MS,EK,TK',1
EXEC [dbo].FH_PackageCreate 576761,'PK1ADA119',119,'AUTO','Alexandria (EG) Flight Stay Package',5,1,'','','ADA','ALY','EG','12/10/2012 12:04:54 PM','12/1/2014 12:04:54 PM','12/10/2012 12:04:54 PM','12/31/2014 12:04:54 PM',1,0,0,119,48,1,1,0,0,72,10,'AED',4,'TK',0,1,123,'',157,0,0,1,'V',3550.0000,0,0,'ALY','MS,OA,ME,QR',1

I concatenated the string by using string builder and put this large string into the SqlCommand and running executeNonQuery statement.

Data Amount I have to stored to DB is over 500,000 records.

I put 5 batch of data, 100000 records  per batch. The first batch is successfully inserted to the database. After one time executing and importing, I dispose the SQL Command and SQL connection I used.

The second batch  cannot be imported to DB.

The Problem I encountered is that having the OutOfMemory Exception when I m running the second batch of data.

Please help me out.

Thanks for all.

Yee Mon P.K


Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>