日期:2014-05-17  浏览次数:21483 次

未经处理的异常: System.IO.FileNotFoundException: 未能加载文件或程序集“accessDA
1.调试时出现图片:上面写着:“System.IO.FileNotFoundException”类型的未经处理的异常出现在 mscorlib.dll 中。
其他信息: 未能加载文件或程序集“accessDAL”或它的某一个依赖项。系统找不到指定的文件
2.工厂(DALFactor)的代码:using System;
using System.Reflection;

namespace DALFactory
{
    public sealed class DataAccess
    {
        private static string path = "accessDAL";
        public static object CreateObject(string className)
        {
            string classname = path + "." + className;
            return Assembly.Load(path).CreateInstance(classname);
        }
    }
3.实现类accessDAL的代码:using System;
using System.Collections.Generic;
using System.Data.OleDb;

namespace accessDAL
{
    public class ABook:IDAL.IBook
    {
        private static string conn = "Provider=Microsoft.Jet.OleDb.4.0;Data Source='I:/软件工程/book.mdb'";
        public Model.Book getBook(string b_name)
        {

            string sqlstring = "select * from book where b_name like " + "'%" + b_name + "%'";
            OleDbConnection ole = new OleDbConnection(conn);
            OleDbCommand dbc = new OleDbCommand(sqlstring, ole);
            ole.Open();
            OleDbDataReader p = dbc.ExecuteReader();
            if (p.Read() == true)
            
            return new Model.Book(p.GetString(0), p.GetFloat(1), p.GetInt32(2), p.GetString(3));
            else
                return null;
        }
    }
}
4.
本人经过各种努力,还是解决不了该问题。。。实在没辙了,希望各位大神帮帮小弟