Please help 
Author Message
 Please help

Hello!

I'm fetching some data from another site using HttpWebResponse and
HttpWebRequest + Regex to get the data I need.
Here is my code to print the results:

Function readHtmlPage(url As String) As String
     Dim res As System.Net.HttpWebResponse
     Dim req As System.Net.HttpWebRequest
     Dim sr As System.IO.StreamReader
     Dim result As String

     req = System.Net.WebRequest.Create(url)
     res = req.GetResponse()
     sr = New
System.IO.StreamReader(res.GetResponseStream(),System.Text.Encoding.UTF7)

     result = sr.ReadToEnd()
     result = Regex.Replace(result, "\n", "")
     result = Regex.Replace(result, "\s+", " ")

     sr.Close()
     res.Close()

  Dim regexp as Regex = New Regex("<p>\s<a
name=.*?></a><b>(?<text1>.*?)</b><font
size=.*?>\s<i>.*?</i>\s<br>(?<text2>.*?)<br></font>",
RegexOptions.IgnoreCase)
  Dim Mc As MatchCollection = regexp.Matches(result)
  Dim M as Match

  For Each M In Mc
  Response.Write(m.Groups("text1").Value & ": " & m.Groups("text2").Value &
"<p>" & vbCrLf)
  next
  myConn.Close()
End Function

This code works fine... But now I need to insert all results into the
database, because information changes only once per day and there is no need
to retreive all data every time when somebody accesses my page.

I tried something like that, but I can't get it work. What I'm doing wrong?
Pleas help me with that code!

......
mySQLQuery = "Insert Into Horoskoop ( Text1, Text2) Values (?,?)"
......
For Each M In Mc


myCmd.ExecuteNonQuery
next

My database table structure:
----------------------
ID  |  Text1  |  Text2
----------------------

Thank You!
Janno



Tue, 28 Dec 2004 22:22:10 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP,

2. PLEASE HELP PLEASE HELP PLEASE HELP

3. Please Help...Crystal Reports..Please Help

4. PLEASE HELP... PLEASE HELP... PLEASE HELP...

5. Please Please PLEASE HELP!!!!!

6. Please please please, help me :-)

7. Please, please, please help!!

8. Cloning problem -- please please please help

9. Please, please, please, help!

10. DATAbase Printing PLEASE, PLEASE Help me - please?

11. DATAbase Printing - PLEASE, PLEASE Help me - please?

12. Please, Please, Please,Help craxdrt.dll

 

 
Powered by phpBB® Forum Software