请问这个代码那里不行?
他显示:
编译错误
说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。
编译器错误信息: BC30390: “System.Data.OleDb.OleDbDataReader.Private Sub New(connection As System.Data.OleDb.OleDbConnection, command As System.Data.OleDb.OleDbCommand, depth As Integer, chapter As System.IntPtr)”是“Private”,因此它在此上下文中无法访问。源错误:
行 19: dim sql as string
行 20: sql="select * from data1"
行 21: com=new oledbdatareader(sql,con)
行 22: dim red as oledbdatareader
行 23: red=com.executereader()
代码如下:
<%@import namespace="system.data.oledb"%>
<%@import namespace="system.data"%>
<HTML>
<HEAD>
<title>WebForm1</title>
</HEAD>
<body>
<script language="vb" runat="server">
sub page_load(sender as object, e as eventargs)
dim con as oledbconnection
dim constr as string
constr="provider=microsoft.jet.oledb.4.0
ata source=" & server.mappath("db1.mdb"
con=new oledbconnection(constr)
con.open()
dim com as oledbcommand
dim sql as string
sql="select * from data1"
com=new oledbdatareader(sql,con)
dim red as oledbdatareader
red=com.executereader()
response.write("<table border=1><tr>"
dim i
for i=0 to red.fieldcount -1
response.write("<td>"
response.write(red.getname(i))
response.write("</td>"
next
end sub
</script>
</body>
</HTML>
请大家帮帮我,为什么会有这个错误?谢谢!