日期:2014-05-19  浏览次数:20593 次

BC30456: 'ExecuteReader' is not a member of 'System.Data.OleDb.OleDbDataAdapter'.个错误怎么解决呀
本来就没有几行程序,怎么找不到错误的原因啊.请高手帮帮忙.
在本面运行程序就提示
Compilation   Error  
Description:   An   error   occurred   during   the   compilation   of   a   resource   required   to   service   this   request.   Please   review   the   following   specific   error   details   and   modify   your   source   code   appropriately.  

Compiler   Error   Message:   BC30456:   'ExecuteReader '   is   not   a   member   of   'System.Data.OleDb.OleDbDataAdapter '.

Source   Error:

 

Line   21:   try
Line   22:   objConnection.open()
Line   23:   objDataReader   =   objCommand.ExecuteReader()
Line   24:   Label1.text   =   objDataReader( "tltle ")
Line   25:   Label2.text   =   objDataReader( "blog ")
 

============源程序============================
<%@   Page   Language= "VB "   ContentType= "text/html "   ResponseEncoding= "gb2312 "   debug= "true "   %>
<!DOCTYPE   html   PUBLIC   "-//W3C//DTD   XHTML   1.0   Strict//EN "   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd ">
<%@   import   namespace= "system "%>
<%@   import   namespace= "system.data "%>
<%@   import   namespace= "system.data.oledb "%>
<script   language= "vb "   runat= "server ">
sub   page_load()
dim   objConnection   as   OleDbConnection
dim   objCommand   as   OleDbDataAdapter
dim   strConnect   as   String  
dim   strCommand   as   String
dim   objDataReader   as   OledbDataReader

strConnect   =   "Provider=Microsoft.Jet.OLEDB.4.0; "
strConnect   +=   "Data   Source=E:\Myproject\mystock\db\ "
strConnect   +=   "myaccont.mdb; "
strCommand   =   "select   title,blog   from   blog   order   by   id   desc "
objConnection   =   new   OleDbConnection(strConnect)
objCommand   =   new   OleDbDataAdapter(strCommand,objConnection)

try
objConnection.open()
objDataReader   =   objCommand.ExecuteReader()
Label1.text   =   objDataReader( "tltle ")
Label2.text   =   objDataReader( "blog ")
objDataReader.Close()
objConnection.Close()
catch   e   as   Exception
con_open.text   =   "connection   failed   to   open   successfully. <br> "
con_close.text   =   e.ToString()
end   try

end   sub
</script>
<html   xmlns= "http://www.w3.org/1999/xhtml ">
<head>
<meta   http-equiv= "content-type "   content= "text/html;   charset=gb2312 "   />
<title> Quadrangle   by   Free   Css   Templates </title>
<meta   name= "keywords "   content= " "   />
<meta   name= "description "   content= " "   />
<link   href= "default.css "   rel= "stylesheet "   type= "text/css "   />