Click here to Skip to main content
15,912,317 members
Home / Discussions / C#
   

C#

 
Questiondrive formating for USB Stick (2nd try) Pin
Martin#25-Oct-06 0:15
Martin#25-Oct-06 0:15 
QuestionRe-implementing string object - Binding issues Pin
GottaseeMe24-Oct-06 23:47
GottaseeMe24-Oct-06 23:47 
QuestionCom Type VT_STREAM in .net 2.0 Pin
chris_do24-Oct-06 22:41
chris_do24-Oct-06 22:41 
Questionhowto: pass parameters to a webservice from browser address bar Pin
baajhan24-Oct-06 22:40
baajhan24-Oct-06 22:40 
AnswerRe: howto: pass parameters to a webservice from browser address bar Pin
chris_do24-Oct-06 23:45
chris_do24-Oct-06 23:45 
QuestionRe: howto: pass parameters to a webservice from browser address bar Pin
baajhan24-Oct-06 23:55
baajhan24-Oct-06 23:55 
AnswerRe: howto: pass parameters to a webservice from browser address bar Pin
chris_do25-Oct-06 0:11
chris_do25-Oct-06 0:11 
QuestionSerialization of a large dataset Pin
TeamWild24-Oct-06 22:40
TeamWild24-Oct-06 22:40 
Hi guys,
I'm having a problem writing out a selialized dataset to a file. Confused | :confused:

I have a very big query that takes over an hour to run Sleepy | :zzz: before it populates a dataset with data. I then process the data within the dataset.

It's not very time efficiend trying to debug the processing part of the code with this long delay so I'd like to dump the data to a binary file which I can load instead of running the query.

This is the code I'm using to try and save the dataset but I get an out of memory exception when I close the file stream.

Any help would REALLY be apreciated. Wink | ;)

<br />
/// <summary><br />
/// Store the data in the dataset to a file<br />
/// </summary><br />
/// <param name="filePath">File path to be used for data storage</param><br />
private void SaveDataToFile( string filePath )<br />
{<br />
	try<br />
	{<br />
		// Accept all changes on the dataset<br />
		this.m_dsModel.AcceptChanges();<br />
<br />
		if( File.Exists(filePath) == true )<br />
		{<br />
			// Delete the existing file<br />
			File.Delete( filePath );<br />
		}<br />
<br />
		// Create a file stream for the output<br />
		FileStream fs = new FileStream( filePath, FileMode.Create, FileAccess.Write);<br />
<br />
		// Construct a BinaryFormatter and use it to serialize the data to the stream.<br />
		BinaryFormatter formatter = new BinaryFormatter();<br />
		try <br />
		{<br />
			formatter.Serialize( fs, this.m_dsModel );<br />
		}<br />
		catch (SerializationException e) <br />
		{<br />
			// TODO: add some propper logging here<br />
                        System.Diagnostics.Trace.WriteLine( e );<br />
		}<br />
		finally <br />
		{<br />
			fs.Flush();<br />
			fs.Close();<br />
		}<br />
	}<br />
	catch(Exception ex)<br />
	{<br />
		// TODO: add some propper logging here<br />
                System.Diagnostics.Trace.WriteLine( e );<br />
	}<br />
}<br />
<br />

AnswerRe: Serialization of a large dataset Pin
V.25-Oct-06 0:11
professionalV.25-Oct-06 0:11 
QuestionRandom numbers Pin
Jad Jadallah24-Oct-06 22:20
Jad Jadallah24-Oct-06 22:20 
AnswerRe: Random numbers Pin
quiteSmart24-Oct-06 22:40
quiteSmart24-Oct-06 22:40 
AnswerRe: Random numbers Pin
J4amieC24-Oct-06 22:41
J4amieC24-Oct-06 22:41 
AnswerRe: Random numbers Pin
V.25-Oct-06 0:08
professionalV.25-Oct-06 0:08 
QuestionHelp me to implement the GridView RowCommand method. Pin
chandu4codeproj24-Oct-06 22:15
chandu4codeproj24-Oct-06 22:15 
QuestionUtf-8 xml string or removing encoding="..." Pin
Csupor Jenő24-Oct-06 22:08
Csupor Jenő24-Oct-06 22:08 
AnswerRe: Utf-8 xml string or removing encoding="..." Pin
Csupor Jenő24-Oct-06 22:38
Csupor Jenő24-Oct-06 22:38 
Questioncount specific character in string Pin
Vipin.d24-Oct-06 21:05
Vipin.d24-Oct-06 21:05 
AnswerRe: count specific character in string Pin
quiteSmart24-Oct-06 21:22
quiteSmart24-Oct-06 21:22 
AnswerRe: count specific character in string Pin
Stefan Troschuetz24-Oct-06 21:24
Stefan Troschuetz24-Oct-06 21:24 
AnswerRe: count specific character in string Pin
Nicholas Butler24-Oct-06 22:32
sitebuilderNicholas Butler24-Oct-06 22:32 
AnswerRe: count specific character in string Pin
Guffa24-Oct-06 22:58
Guffa24-Oct-06 22:58 
Questionhow to use the printDialogBox? Pin
quiteSmart24-Oct-06 20:11
quiteSmart24-Oct-06 20:11 
AnswerRe: how to use the printDialogBox? Pin
Nader Elshehabi24-Oct-06 22:03
Nader Elshehabi24-Oct-06 22:03 
GeneralRe: how to use the printDialogBox? Pin
quiteSmart24-Oct-06 22:43
quiteSmart24-Oct-06 22:43 
QuestionHow can I add the assembly Microsoft.Office.Interop.Outlook? Pin
OctopusThu24-Oct-06 19:26
OctopusThu24-Oct-06 19:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.