当前位置: 代码迷 >> ASP.NET >> 这个异常: cannot be converted to '1-dimensional
  详细解决方案

这个异常: cannot be converted to '1-dimensional

热度:1751   发布时间:2013-02-25 00:00:00.0
这个错误: cannot be converted to '1-dimensional
错误如下:
BC30311:   Value   of   type   'System.Data.OleDb.OleDbDataReader '   cannot   be   converted   to   '1-dimensional   array   of   System.Data.OleDb.OleDbDataReader '.

Source   Error:
Line   96:   obReader   =   cmd.executeReader   ()

源代码如下:
'显示所选学生其它信息
Sub   ShowOtherInfo(Sender   as   Object,   e   as   EventArgs)
dim   cmd   as   New   OleDbCommand()
dim   conn   As   New     OleDbConnection() 'OleDbConnection()
conn.ConnectionString   =   "Provider=Microsoft.Jet.OLEDB.4.0;   Data   Source   =   "   &   Server.MapPath( "data/qrms.mdb ")  
conn.Open()
cmd.Connection   =   conn
cmd.CommandText   =   "Select   *   from   Chengji   Where   Course   = ' "   &   drpCourse.SelectedItem.text   &   " '   and   XueHao   = ' "   &   drpXuehao.SelectedItem.text   &   " ' "
dim   obReader   as   OleDbDataReader()


obReader   =   cmd.executeReader   ()
while     obReader.read()
names.text   =   obReader.item( "names ")
eScore.text   =   obReader.item( "eScore ")
zScore.text   =     obReader.item( "zScore ")
sScore.text   =   obReader.item( "sScore ")
      Score.text   =   obreader.item( "score ")
end   While
'obReader.close
'conn.close

end   Sub

帮忙看一下,快要交了


------解决方案--------------------------------------------------------
names.text = obReader.GetString(0)