代码生成器加载用户表和视图报错解决方案|C/S框架网
代码生成器加载用户表和视图报错解决方案|C/S框架网
报错原因:
选择的数据库名称没有实例化对应的数据库,因为加载tb_DataSet表时没有返回账套数据信息,可能是IsVisible=N
修改DatabaseProvider.cs文件:
C# Code:
/// <summary>
/// 获取数据库实例
/// </summary>
/// <param name="DBName">数据库名称</param>
/// <returns></returns>
public static IDatabase GetDatabaseByDbName(string DBName)
{
if (DBName == DEF_SYSTEM_DBName)
{
return DatabaseProvider.SystemDatabase;
}
else
{
DataSetConfigItem item = DatabaseProvider.DataSetConfigList.DataSets.Find(
delegate (DataSetConfigItem p) { return p.DBName.ToLower() == DBName.ToLower(); });
if (item != null)
return GetDatabase(item.DataSetID);
else
throw new Exception("未加载数据库名<" + DBName + ">对应的账套数据库!");
}
}
//来源:C/S框架网(www.csframework.com) QQ:23404761
/// <summary>
/// 获取数据库实例
/// </summary>
/// <param name="DBName">数据库名称</param>
/// <returns></returns>
public static IDatabase GetDatabaseByDbName(string DBName)
{
if (DBName == DEF_SYSTEM_DBName)
{
return DatabaseProvider.SystemDatabase;
}
else
{
DataSetConfigItem item = DatabaseProvider.DataSetConfigList.DataSets.Find(
delegate (DataSetConfigItem p) { return p.DBName.ToLower() == DBName.ToLower(); });
if (item != null)
return GetDatabase(item.DataSetID);
else
throw new Exception("未加载数据库名<" + DBName + ">对应的账套数据库!");
}
}
//来源:C/S框架网(www.csframework.com) QQ:23404761
LoadDatabase方法调用新存储过程:
C# Code:
public static void LoadDatabase(string DBIDs)
{
CommandHelper sp = DatabaseProvider.SystemDatabase.CreateSqlProc("sp_sys_GetDataSet4Generator");
//省略代码....
}
//来源:C/S框架网(www.csframework.com) QQ:23404761
public static void LoadDatabase(string DBIDs)
{
CommandHelper sp = DatabaseProvider.SystemDatabase.CreateSqlProc("sp_sys_GetDataSet4Generator");
//省略代码....
}
//来源:C/S框架网(www.csframework.com) QQ:23404761
VIP会员下载:sp_sys_GetDataSet4Generator.rar
版权声明:本文为开发框架文库发布内容,转载请附上原文出处连接
NewDoc C/S框架网