程序三层结构中出现的问题!!!急急。。。。。。。。
我现在的做的项目是采用三层结构实现的,但是程序编码的过程中出现了下面的错误:“BLL.TestBll”的类型初始值设定项引发异常
现将程序代码简化如下:
1、aspx.cs:
protected void Button1_Click(object sender, EventArgs e)
{
SetDataView("select * from title");
}
public void SetDataView(string query )
{
DataSet myDataSet = new DataSet();
myDataSet= BLL.TestBll.QueryDataSource(query );
this.GridView1.DataSource = myDataSet;
this.GridView1.DataBind();
}
2、BLL层:
namespace BLL
{
public class TestBll
{
private static readonly ITest test = DataAccess.CreateTest();
public static DataSet QueryDataSource(string query)
{
return test.QueryOfDataSource(query);
}
}
}
3、DALFactory
public class DataAccess
{
//private static readonly string path = ConfigurationManager.AppSettings["WebDAL"];
private static readonly string path = "SQLProfileDAL";
public static ITest CreateTest()
{
string classname = path + ".DBTest";
return (ITest)Assembly.Load(path).CreateInstance(classname);
}
}
4、DBUtility
SqlHelp()类:略.....
5、IDAL
namespace IDAL
{
public inte易做图ce ITest
{
DataSet QueryOfDataSource(string query);
}
}
6、Model
.
.
.
.
略
7、SQLProfileDAL
namespace SQLProfileDAL
{
public class DBTest:IDAL .ITest
{
SqlHelp help = new SqlHelp();
public DataSet QueryOfDataSource(string query)
{
return help.ExecuteDataSet(query);
}
}
}
程序运行到调用BLL中的方法时就出现了上面的错误。请各位大虾帮帮我,急啊!!!!!!
--------------------编程问答-------------------- 0分
补充:.NET技术 , ASP.NET