streamReader and writer
hey all
does anyone know how i can read text from a website and write the information into a database table using streamreader and streamwriter??
anyone know how or any good tutorials??
thanks (once again!!!)
[235 byte] By [
sohail] at [2007-11-11 7:25:44]

# 1 Re: streamReader and writer
This article is on screen scrapes in the same lines you are looking to read web pages, this code assigns the web page text to a label , you can use a reader/ writer and access the database , does that help?
http://www.4guysfromrolla.com/webtech/070601-1.shtml
# 2 Re: streamReader and writer
thanks for the information,
but what i need to know is how can i take a screen scrape and put the information into a table in my MS Access database?
sohail at 2007-11-11 23:14:51 >

# 3 Re: streamReader and writer
Isnt the screen scrape available as a string,So lets say you are saving the entire html
I am not sure it is this that you want i am giving you code for sql server
SqlConnection sqlCon = new SqlConnection(connectionstring);
sqlCmd.CommandText = "INSERT INTO TABLENAME VALUES (" +stringofhtml + ");";
sqlCmd.CommandType = CommandType.Text;
sqlCmd.Connection = sqlCon;
sqlCmd.ExecuteNonQuery();
TABLENAME, connString should be dependent on your database
# 4 Re: streamReader and writer
thanks for the information
what i am exactly trying to do is go to a website for example a weather website and take the days temperature and write that to my database i shall be using MS Access database what i need to know is how can i use streamReader to read the temperature and then streamWriter to write it directly to my database?
sohail at 2007-11-11 23:16:50 >

# 5 Re: streamReader and writer
The resultant string will be a regular html document you will have to understand the format and parse it to get the information.
Isnt there a web service you can use which will give back the value instead of a website. In your case consuming a webservice makes sense I mean imagine trying to find the value on the page as per your requirement, could be difficult