我是编程新手,但我在这个页面上已经阅读了很多问题和答案,这对我帮助很大。我有一个代码可以在网页上查找信息并将其存储在数据库中,我到目前为止唯一的问题是文本有重音字符,我不知道如何选择正确的编码。
Dim Web1 As New HtmlAgilityPack.HtmlWeb
Dim Doc1 As New HtmlAgilityPack.HtmlDocument
Doc1 = Web1.Load("http://207.248.177.30/regulaciones/scd_expediente_3.asp?ID=01/0922/130214)
Dim uri As Uri = Nothing
Dim linksOnPage = From link In doc.DocumentNode.Descendants()
Where link.Name = "a" _
AndAlso link.Attributes("href") IsNot Nothing _
Let text = link.InnerText.Trim()
Let url = link.Attributes("href").Value
Where uri.TryCreate(url, UriKind.RelativeOrAbsolute, uri)
Dim postabla As Integer = 1
Dim fecha1 As HtmlNode
Dim ACR2 As HtmlNode
Dim ACR3 As HtmlNode
Dim ACR4 As HtmlNode
Dim ACR5 As HtmlNode
For Each link In linksOnPage
Dim cb As New OleDb.OleDbCommandBuilder(da)
Dim dsNewRow As DataRow
Dim value1 As String
value1 = link.url
If value1.Contains("207.248.177.30") Then
dsNewRow = ds.Tables("infoenlace").NewRow()
dsNewRow.Item("Expediente") = exped
dsNewRow.Item("TipoDocumento") = link.text
dsNewRow.Item("EnlaceWeb") = link.url
fecha1 = doc.DocumentNode.SelectSingleNode("//tr[@class='tituloPantalla']/following-sibling::tr[" & postabla & "]/td[2]")
dsNewRow.Item("Fecha") = fecha1.InnerHtml
fecha1 = doc.DocumentNode.SelectSingleNode("//tr[@class='tituloPantalla']/following-sibling::tr[" & postabla & "]/td[3]")
dsNewRow.Item("Remitente") = fecha1.InnerHtml
postabla = postabla + 2
ds.Tables("infoenlace").Rows.Add(dsNewRow)
da.Update(ds, "infoenlace")
Next
Return uri
End Function
非常感谢!问题是代码而不是录制“Nuevaversión”。提出“Nuevaversi n。”