Wednesday 19 February 2014

how to fetch data from the notepad file

OR
how to get data from the notepad file

--> create the function in your code behind file
------------------------------------------------------------------------------------------------
public Fetch_Data_From_Notapad()
{   
            string line = "";
 StreamReader streamReader = File.OpenText(Server.MapPath("notepad_file_path.txt"));
           do
            {
             line = streamReader.ReadLine();
            // it is for change new line or next line in notepad file
             string[] data = line.Split(';');
            // your notepad in first line's data in array member by splite function

    // You can splite data in array like following changes
    /* string[] data = line.Split('-');
     string[] data = line.Split('/');
     string[] data = line.Split('/');
     string[] data = line.Split(' ');
     string[] data = line.Split('Your specific character');   
    */
   
    //now Your data in array and you use follows
     string code = data[0];
    string name = data[1];
    string date = data[2];
             } while (streamReader.Peek() != -1); // it is for end of the file          
}

--> above function use on click event and fetch data from the notepad file

No comments:

Post a Comment



Asp.net tutorials