为什么这样也出错
大家帮我看看,为什么老是提示出错:
-------------------
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.NullReferenceException: 未将对象引用设置到对象的实例。
源错误:
------------------
这是我的一个插入按钮,我不知错在那里了,难道下面这个插入按钮有问题吗?
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim myrow As DataRow
myrow = ds.Tables("tregion").NewRow
myrow("region_code") = TextBox1.Text
myrow("region_desc") = TextBox2.Text
ds.Tables("tregion").Rows.Add(myrow)
DataGrid1.DataSource = ds.Tables("tregion")
DataGrid1.DataBind()
End Sub