Ya sure Nukkumatti,
I will give u the code which I have written.
[WebMethod]
public DataSet NextPRSerialNumber()
{
String filename = ConfigurationSettings.AppSettings["PRNumFile"];
System.IO.StreamReader file = new System.IO.StreamReader(filename);
String strNum = file.ReadToEnd();
file.Close();
System.IO.StreamWriter file2 = new System.IO.StreamWriter(filename,false);
strNum = Convert.ToString(Convert.ToInt32(strNum) + 1);
file2.WriteLine(strNum);
file2.Close();
DataTable dt = new DataTable();
dt.Columns.Add("PRSerialNumber");
dt.Rows.Add(new object[]{"PR_" + DateTime.Today.Year + "_" + strNum.PadLeft(6,'0')});
DataSet ds = new DataSet();
ds.Tables.Add(dt);
return ds;
}
In ur web.config file,u should have the following...U can change this based on ur text file's location.
<appSettings>
<add key="PRNumFile" value="C:\MCG\WebService_PR\PRNum.txt" />
</appSettings>
I think u should be able to understand the above code.
Do the modifications as how u want it.
Regards,
Abhishek.