DataReader ASP.NET(Visual Basic)的问题

时间:2010-05-28 12:01:26

标签: asp.net vb.net datareader

我有这个问题:

[InvalidOperationException: No data exists for the row / column.]
   System.Data.OleDb.OleDbDataReader.DoValueCheck(Int32 ordinal) +1029063
   System.Data.OleDb.OleDbDataReader.GetInt32(Int32 ordinal) +12
   ASP.addsousvoyage_aspx.hdVoyage_SelectedIndexChanged(Object sender, EventArgs e) in C:\Users\ZiGi\Desktop\VisualDesign\addSousVoyage.aspx:222
   System.Web.UI.WebControls.ListControl.OnSelectedIndexChanged(EventArgs e) +111
   System.Web.UI.WebControls.DropDownList.RaisePostDataChangedEvent() +134
   System.Web.UI.WebControls.DropDownList.System.Web.UI.IPostBackDataHandler.RaisePostDataChangedEvent() +10
   System.Web.UI.Page.RaiseChangedEvents() +165
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1485

当我这样做时:

  

MSGBOX(myReader1.GetInt32(0)的ToString)

即使:

MsgBox(myReader1.FieldCount)返回1作为值,字段(0)是整数。

有什么问题?

1 个答案:

答案 0 :(得分:1)

你忘了做myReader1.Read()吗? 我认为当它被遗忘时会发生这种错误。