tags:

views:

114

answers:

1

I have a text file stored in my sql DB. in that .txt file I have certain numbers like:

99435
87889
33455
33555
34556

How to get the count of these numbers from the txtfile stored in the database? Also to read the file and fetch the number one by one in a string?

I am using asp.net (C#)

A: 

As Henk says, we need some more details about how the file/data is stored, but after you've got the file into memory as a string all you need to do is something similar to:

string[] array = data.Split(new char[] { ' ', '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);  
System.Diagnostics.Debug.WriteLine(string.Format("Number of numbers: {0}", array.Length));  
foreach(string str in array)  
{  
    System.Diagnostics.Debug.WriteLine(str);  
}  
ho1