-
Jul 29, 2006, 12:25 PM
#1
wierd error in c#
i am calling a function thats reads a text file but the strange thing is that it only reads two files at a time
this fucntion calls the reader function
while((this.fromdateDT.Equals(this.todateDT))!=tru e)
{
day=Convert.ToString(this.fromdateDT.Day);
month=Convert.ToString(this.fromdateDT.Month);
year=Convert.ToString(this.fromdateDT.Year);
temp=year+"-"+month+"-"+day;
this.fileName=this.pathString+"smdrbackup"+temp+". csv";
try
{
this.runReader(this.fileName);
}
catch
{
}
this.fromdateDT=this.fromdateDT.AddDays(1);
}
runReader is the function that reads the file
the code snipet that does the reading here in that function is
Stream str= File.Open(CSVpath,FileMode.Open, FileAccess.Read,FileShare.ReadWrite);
StreamReader sr;
sr= new StreamReader(str);
but if say for example it is suppose to read the following files: k2006-10-12,k2006-10-13,k2006-10-14,k2006-10-15. it reads the first two and say the last two do not exist. but they do and if i skip out the first two and have k2006-10-14,k2006-10-15,k2006-10-16 it once again only reads the first two even though in another order it said it could not find them.
so basically its only accessing two files after that it says every other fiel does not exist.................anyone have had a problem like this
-
Jul 29, 2006, 01:01 PM
#2
i am going try and take out this section and try do it seperately because i dont know if any of my otehr processes that are running is affecting this procedure from occurring will post result but would still like to know if anybody ever had a problem like this. i am wondering if is some memory aspect is the isee or something needs to be disposed not sure as yet though
-
Jul 29, 2006, 06:39 PM
#3
problem solved guys dont worry after debugging and stepping through the code continuously i realised that oone of the other threads that where running was affecting my thread that was reading from a specific directory. so i jus changed the design of the code.
cant believe the problem was caused from something totally different i guess you live an learn
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules