我有以下代码,我正在尝试用这些信息更新一个新的数据库行。我很确定我以前曾这样做过,但它会因在线上的“NullReferenceExcetption”而崩溃
dtItemsFeed = taItemsFeed.GetData()
代码(精简)如下:
Public Partial Class downloaditems
Private dtItemsFeed As dsItems.ItemsFeedDataTable
Private taItemsFeed As dsItemsTableAdapters.ItemsFeedTableAdapter
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
checkSite("http://www.tiag.me/whatever/header.html", "Header")
End Sub
Private Sub checkSite(ByVal URL As String, ByVal Type As String)
dtItemsFeed = taItemsFeed.GetData()
Dim rFeed As dsItems.ItemsFeedRow
rFeed = dtItemsFeed.NewItemsFeedRow
### Code that loads items ###
rFeed.HeaderCode = sourcecode
rFeed.LastImport = System.DateTime.Now
rFeed.Verified = "True"
dtItemsFeed.AddItemsFeedRow(rFeed)
taItemsFeed.Update(dtItemsFeed)
End Sub
End Class
当我查看编辑数据集时数据有效,所以我知道它正在连接
错误:
任何帮助将不胜感激。汤姆