.Net Framework 数据提供程序要求 Microsoft Data Access Components(MDAC)。请安装 Microsoft Data Access Components(MDAC) 2.6 或更高版本。web.config<add key="ConnectionString" value="provider=microsoft.jet.oledb.4.0; data source=D:\asp.net\mybusy\App_Data\mybusyness.mdb" />olebase.cs
 //执行SQL语句并返回数据集
    public static DataSet ExecuteSql4Ds(string strsql)
    {
        OleDbConnection mycn = new OleDbConnection(strconn);
        try
        {
            mycn.Open();
            OleDbDataAdapter sda = new OleDbDataAdapter(strsql, mycn);
            DataSet ds = new DataSet("ds");//创建数据集
            sda.Fill(ds);
            return ds;
        }
        catch (OleDbException e)
        {
            throw new Exception(e.Message);
        }
        finally
        {
            mycn.Close();
        }
    }NewProduct.ascxprotected void Page_Load(object sender, EventArgs e)
        {
            string sSql = "select top 3 * from product";
            DataSet ods = olebase.ExecuteSql4Ds(sSql);
            Dlist1.DataSource = ods.Tables[0].DefaultView;
            Dlist1.DataBind();
            //DataList1.DataSource = ods.Tables[0].DefaultView;
            //DataList1.DataBind();
        }
       override protected void OnInit(EventArgs e)
        {
            InitializeComponent();
            base.OnInit(e);
        }
        private void InitializeComponent()
        {
            this.Load += new System.EventHandler(this.Page_Load);
        }

解决方案 »

  1.   

    一、设置Web.Config。删除加以下代码以下是引用片段:
    <connectionStrings/>加以下代码 
         <connectionStrings> 
             <add name="zgdxConn" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\newsData.mdb" providerName="System.Data.OleDb"/> 
         </connectionStrings> 
      二、ASP.NET2.0中读取web.config数据库连接字符串2种方法  方法一:以下是引用片段:
    string myConn = System.Configuration.ConfigurationManager.ConnectionStrings["zgdxConn"].ConnectionString; 
      方法二:以下是引用片段:
    string myConn = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["zgdxConn"].ToString(); 
      三、倒入命名空间  如果数据库是Access:以下是引用片段:
    using System.Data.OleDb; 
      如果数据库是SqlServer;以下是引用片段:
    using System.Data.SqlClient; 
      

  2.   

    olebase.cs 
     //执行SQL语句并返回数据集 
        public static DataSet ExecuteSql4Ds(string strsql) 
        { 
    string   strconn   =   System.Configuration.ConfigurationManager.ConnectionStrings[ "zgdxConn "].ConnectionString;  //加这句话
            OleDbConnection mycn = new OleDbConnection(strconn); 
            try 
            { 
                mycn.Open(); 
                OleDbDataAdapter sda = new OleDbDataAdapter(strsql, mycn); 
                DataSet ds = new DataSet("ds");//创建数据集 
                sda.Fill(ds); 
                return ds; 
            } 
            catch (OleDbException e) 
            { 
                throw new Exception(e.Message); 
            } 
            finally 
            { 
                mycn.Close(); 
            } 
        } 
    你没  string   myConn   =   System.Configuration.ConfigurationManager.ConnectionStrings[ "zgdxConn "].ConnectionString;  
      

  3.   

    请到微软网站:
    http://www.microsoft.com/downloads/details.aspx?FamilyID=6c050fe3-c795-4b7d-b037-185d0506396c&displaylang=zh-cn
    下载下来,然后安装!
      

  4.   


    你直接在WEBFORM中写吧:OleDbConnection sqlcon=new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+HttpContext.Current.Server.MapPath("ask.mdb"));
      
    你可以访照的写,绝对可以的.
      

  5.   

    ask.mdb是数据库名,不要写路径,只写数据库名.
      

  6.   

    把原来的MDAC卸干净了再装
    我也碰到过这个问题,后来我把系统重装了,才行,FUCK
      

  7.   

    装个windows2003的补丁就可以了
    WindowsServer2003-KB914961-SP2-x86-CHS.exe