I want to read just the last record of file....I m able to read the whole file.
Secondly I want to know that in VB.Net we have ubound to get the upper bound of the array..What is the equivalent in ASP.net?
protected void Page_Load(object sender, EventArgs e)
{
string sProdID;
string sID="P000";
string sLastLine;
string[] sArr;
string sPath = Server.MapPath("~/") ;
string sFileName = sPath + "Products.txt";
if (File.Exists(sFileName.Trim()) == true)
{
sArr = System.IO.File.ReadAllLines(sFileName);
}
}
Above code read the File...
Suppose mine file contains-
1^^^^Desc1^^^^50.00^^^^12
2^^^^Desc2^^^^50.00^^^^12
3^^^^Desc3^^^^50.00^^^^12
4^^^^Desc4^^^^50.00^^^^12
5^^^^Desc5^^^^50.00^^^^12
6^^^^Desc6^^^^50.00^^^^12
7^^^^Desc7^^^^50.00^^^^12
8^^^^Desc8^^^^50.00^^^^12
9^^^^Desc9^^^^50.00^^^^12
10^^^^Desc10^^^^50.00^^^^12