这个问题貌似很多人都遇到了,我也不例外,但是没找到我的问题出在哪了,贴出代码大家帮我看看。
<?xml version="1.0"?>
<!--
数据库连接配置
-->
<configuration>
<configSections>
</configSections>
<!--反射 -->
<appSettings>
<add key="DAL" value="BoteAutoWMS.SQLServerDAL"/>
</appSettings>
<!--连接字符串-->
<connectionStrings>
<add name="DBconnstring" connectionString="Server=.;uid=sa;pwd=123;database=BoteAutoCMS" providerName="System.Data.SqlClient" />
</connectionStrings></configuration>
/// <summary>
/// 创建抽象工厂模式
/// </summary>
public class DataAccess
{ /// <summary>
///
/// </summary>
private static readonly string path = ConfigurationManager.AppSettings["DAL"].ToString().Trim(); /// <summary>
/// 创建用户层数据接口
/// </summary>
/// <returns></returns>
public static BoteAutoWMS.IDAL.IAdminUser CreateAdminUser()
{
try
{
string className=path +".AdminUser";
return (IDAL.IAdminUser)Assembly.Load(path).CreateInstance(className);
}
catch(Exception er)
{
throw new Exception(er.Message);
}
}
}没发现哪有不合适的地方
<?xml version="1.0"?>
<!--
数据库连接配置
-->
<configuration>
<configSections>
</configSections>
<!--反射 -->
<appSettings>
<add key="DAL" value="BoteAutoWMS.SQLServerDAL"/>
</appSettings>
<!--连接字符串-->
<connectionStrings>
<add name="DBconnstring" connectionString="Server=.;uid=sa;pwd=123;database=BoteAutoCMS" providerName="System.Data.SqlClient" />
</connectionStrings></configuration>
/// <summary>
/// 创建抽象工厂模式
/// </summary>
public class DataAccess
{ /// <summary>
///
/// </summary>
private static readonly string path = ConfigurationManager.AppSettings["DAL"].ToString().Trim(); /// <summary>
/// 创建用户层数据接口
/// </summary>
/// <returns></returns>
public static BoteAutoWMS.IDAL.IAdminUser CreateAdminUser()
{
try
{
string className=path +".AdminUser";
return (IDAL.IAdminUser)Assembly.Load(path).CreateInstance(className);
}
catch(Exception er)
{
throw new Exception(er.Message);
}
}
}没发现哪有不合适的地方
解决方案 »
- c#字符串数组快速转换字符串
- TreeView控件
- c#怎样实现进程间的拖放操作
- “如果x是否是组合框类型”,即if(x.GetType()==组合框类型),这个语句如何写?
- class clasname <Type>...这个<Type>是啥意思...我在别人的问题看到的不解之外...进来看看代码
- 用C#调用Excel怎样打印预览多个Sheet???急!!!
- 如何得到任务栏图标的坐标?(不在鼠标事件中)
- 一大堆using语句使用的危害?
- 再问GDI+的问题,如何获得Region的边界线
- 请问在C#中如何计算字符串的总字节数?哪位高人指点一下,谢谢!
- asp.net mvc 传中文参数问题
- 谁能给我一份图书管理系统的源码呀!
" 在 BoteAutoWMS.BLL.AdminUser.CheckUserLogin(AdminInfo admininfo)\r\n 在 BoteAutoWMS.frmLogin.lblSumbit_Click(Object sender, EventArgs e) 位置 D:\\coding\\BoteAutoWMS\\BoteAutoWMS\\BoteAutoWMS\\frmLogin.cs:行号 96\r\n 在 System.Windows.Forms.Control.OnClick(EventArgs e)\r\n 在 System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)\r\n 在 System.Windows.Forms.Control.WndProc(Message& m)\r\n 在 System.Windows.Forms.Label.WndProc(Message& m)\r\n 在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)\r\n 在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)\r\n 在 System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)\r\n 在 System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)\r\n 在 System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)\r\n 在 System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)\r\n 在 System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)\r\n 在 System.Windows.Forms.Form.ShowDialog(IWin32Window owner)\r\n 在 System.Windows.Forms.Form.ShowDialog()\r\n 在 BoteAutoWMS.Program.Main() 位置 D:\\coding\\BoteAutoWMS\\BoteAutoWMS\\BoteAutoWMS\\Program.cs:行号 21\r\n 在 System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)\r\n 在 System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)\r\n 在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()\r\n 在 System.Threading.ThreadHelper.ThreadStart_Context(Object state)\r\n 在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)\r\n 在 System.Threading.ThreadHelper.ThreadStart()"