dim mycommand as sqldatasetcommand
............
mycommand.filldataset(ds,"admin")这里应该用sqldataadapter对象来填充dataset对象。

解决方案 »

  1.   

    你使用SqlConnection来访问Access数据库应该是不可以的,反问Access你需要使用System.Data.OleBD.
      

  2.   

    <%@ Import Namespace="System.Data" %>
    <%@ Import Namespace="System.Data.OleDb" %>
    <html>
    <head>
    <script language="VB" runat="server">
    sub page_Load(Src as Object,E as EventArgs)
    dim ds as dataset
    dim myconnection as oledbconnection
    dim mycommand as oledbcommand
    myconnection=new oledbconnection("DBQ=" + server.mappath("admin/exam.mdb") + ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};")
    mycommand=new oledbcommand("Select * from admin",myconnection)
    ds=new dataset()
    mycommand.filldataset(ds,"admin")
    mydatagrid.datasource=ds.tables("admin").defaultview
    mydatagrid.databind()

    end sub
    </script>
    <title>
    DataBase Test
    </title>
    </head>
    <center>
    <body>
    <h3><font face="Verdana">DOT NET DATABASE TEST</font></H3>
    <asp:DataGrid id="mydatagrid" runat="server" width="600" BackColor="white" BorderColor="black" ShowFooter="false" CellPadding=3 cellSpacing="0" Font-Name="Verdana" Font-Size="8pt" HeaderStyle-BackColor="#aaaadd" MaintainState="false"/>
    </body>
    </center>
    </html>
      

  3.   

    你好,wtadminxjeri(P42.4)。上面的代码事你给我的问题的回复,但我测试过了,还是有错误哦。
    错误是:'filldataset'is not a member of 'system.Data.Oledb.oledbcommand'.
    错误是在第十三行(mycommand.FillDataSet(ds,"admin")
    )。因为我是刚刚开始学ASP.NET,请指教。
      

  4.   

    sorry,前面只是简单转了一下,没有注意细节dim ds as dataset
    dim myconnection as oledbconnection
    dim mycommand as oledbdataadapter
    myconnection=new oledbconnection("DBQ=" + server.mappath("admin/exam.mdb") + ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};")
             myconnection.open()
    mycommand=new OleDbDataAdapter("Select * from admin",myconnection)
    ds=new dataset()
    mycommand.filldataset(ds,"admin")
    mydatagrid.datasource=ds.tables("admin").defaultview
    mydatagrid.databind()
             myconnection.close()
      

  5.   

    你好,wtadminxjeri我已经了你的代码,还是有问题啊。还是提示filldataset 不是OleDbDataAdapter的成员哦。
    你能不能试成功了再答我啊
      

  6.   

    BETA版么?
    如果不是 那需要用新版本的 NAMESPACE
      

  7.   

    我是在windows2003下面运行的啊。
    我都改过为fill,但另外个错误啊!错误的意思是说:connectionstring 中没有provider啊。你们可不可以改一下运行,你们就会看到有错误啦。大家快点帮帮小弟啦。