Last post Feb 23, 2012 07:31 AM by Mikesdotnetting
Feb 23, 2012 05:13 AM|Pradeep poojary|LINK
How can i read HTML file automatically from a folder ,,say for every hour ?!! My requirement is to read the files from a folder automatically and store it in database. till now, i was able to read data from the HTML file(when user uploads it manually)
and store it in database. But how can i make my program to read the file automatically.
Here is the code to achive read the data from HTML file and store it in database. how can i make changes in this code so that HTML files is automatically read and store the data in database.
protected void Button1_Click(object sender, EventArgs e)
int inap = 0, outap = 0;
StreamReader file = new StreamReader(FileUpload1.FileContent);
htmldata = file.ReadToEnd();
NOTE : This is not the complete code, i've removed all the busniess logic part, coz i want to show how am reading the file and how can i automate this code to read automatically. If you need more information on this or complete code, pls let me know.
Feb 23, 2012 07:31 AM|Mikesdotnetting|LINK
You can use methods in the
Directory class to get a list of files. You can either use the GetFiles or EnumerateFiles method and then process each file in the collectio nthat is returned.