积极答复者
未将对象引用设置到对象的实例。

问题
-
Private Sub dgbind()
Dim conn As New OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("House.mdb"))
Dim adp As New OleDbDataAdapter("SELECT HouseRent.城市, HouseRent.位置区域, HouseRent.楼盘名称, HouseRent.建筑面积, HouseRent.使用面积, HouseRent.装修程度, HouseRent.出租方式, HouseRent.备注, HouseRent.联系人, HouseRent.联系电话, HouseRent.Email FROM (HouseRent INNER JOIN 个人资料表 ON HouseRent.联系人 = 个人资料表.真实姓名)", conn)
adp.MissingSchemaAction = MissingSchemaAction.AddWithKey '加上主键字段
ds = New DataSet()
adp.Fill(ds, "HouseRent")
Dim dcKey() As DataColumn = {ds.Tables("HouserRent").Columns("联系人")}
ds.Tables("HouseRent").PrimaryKey = dcKey
DataGrid1.DataSource = ds.Tables("HouseRent").DefaultView
DataGrid1.DataBind()
Session("ds") = dsEnd Sub
错误代码处:dcKey() As DataColumn = {ds.Tables("HouserRent").Columns("联系人")}
错误原因:{"未将对象引用设置到对象的实例。"}
用户代码未处理 System.NullReferenceException
Message="未将对象引用设置到对象的实例。"
Source="App_Web_rvyqzxf9"
StackTrace:
在 infor_rent.dgbind() 位置 F:\asp.net\FangWuZuLin\infor_rent.aspx.vb:行号 22
在 infor_rent.Page_Load(Object sender, EventArgs e) 位置 F:\asp.net\FangWuZuLin\infor_rent.aspx.vb:行号 11
在 System.Web.UI.Control.OnLoad(EventArgs e)
在 System.Web.UI.Control.LoadRecursive()
在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
InnerException:
又是哪里出错了?- 已移动 Sheng Jiang 蒋晟Moderator 2009年11月14日 15:22 ADO.net数据集问题 (发件人:ASP.NET 与 AJAX)