|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
limits for filestreams (C#)rows in the datastream is 416. I count as I write to the filestream and again I get 416. However, when I open the file, there are only 392 rows. What happened? Where are my missing rows? Are there limits to using filestreams? Thoughts? --gloria ------------------------------------- StreamWriter outputfileSW = File.CreateText(filenameStr); string extractpartsStr = "select ..." ; try { OleDbConnection extractpartsCN = new OleDbConnection(extractbpmClass.strConn); OleDbDataAdapter extractpartsDA = new OleDbDataAdapter(extractpartsStr,extractpartsCN); DataSet extractpartsDS = new DataSet(); extractpartsDA.Fill(extractpartsDS); string subinvStr, partnumStr, descStr, serializedflagStr, statusStr, hscodeStr; string cooStr, newpartflagStr, BAXLineStr; string tab = "\t"; int serializedInt, newpartInt; DataTable build888Table = extractpartsDS.Tables[0]; int totalrows = build888Table.Rows.Count; int countrows = 0; foreach(DataRow build888Row in build888Table.Rows) { subinvStr = build888Row["SubInv"].ToString(); partnumStr = build888Row["PartNum"].ToString(); descStr = build888Row["PartDescr"].ToString(); serializedflagStr = build888Row["SerialFlag"].ToString(); statusStr = build888Row["Status"].ToString(); hscodeStr = build888Row["HSCode"].ToString(); cooStr = build888Row["COO"].ToString(); newpartflagStr = build888Row["NPFlag"].ToString(); if (serializedflagStr == "False") serializedInt = 1; else serializedInt = 0; if (newpartflagStr == "False") newpartInt = 1; else newpartInt = 0; BAXLineStr = subinvStr + tab + partnumStr + tab + descStr + tab + //13 tabs tab + tab + tab + tab + tab + tab + tab + tab + tab + tab + tab + tab + tab + serializedInt + tab + statusStr + tab + tab + hscodeStr + tab + cooStr + tab + //37 tabs tab + tab + tab + tab + tab + tab + tab + tab + tab + tab + tab + tab + tab + tab + tab + tab + tab + tab + tab + tab + tab + tab + tab + tab + tab + tab + tab + tab + tab + tab + tab + tab + tab + tab + tab + tab + tab + newpartInt; outputfileSW.WriteLine(BAXLineStr); countrows = countrows+1; } Console.WriteLine("\ttotalrows: " + totalrows); Console.WriteLine("\n\tcountrows: " + countrows); gloria <gurba***@gmail.com> wrote:
> So I am writing data from a datastream to a filestream. The count of You're not closing the writer as far as I can see, which means it might > rows in the datastream is 416. I count as I write to the filestream > and again I get 416. However, when I open the file, there are only 392 > rows. What happened? Where are my missing rows? Are there limits to > using filestreams? not get flushed. You should use a using statement to make sure that the StreamWriter gets closed whatever happens. -- Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet If replying to the group, please do not mail me too
Other interesting topics
Deserialization constructor
Writing a windows service with a socket interface. Exception with HttpWebRequest.GetResponse .NET Validators Combined with Javascript Dynamicly refrence a .NET DLL Launch WebBrowser Command to terminate execution Error Occurs When using ADO.NET OLEDbDataAdapter to Modify Excel windows service : Error 2186 Problem referencing other classes from ASP.NET code behind class |
|||||||||||||||||||||||