diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Form/Scheme/FormSchemeBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Form/Scheme/FormSchemeBLL.cs index 2964baaf7..4cff056d4 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Form/Scheme/FormSchemeBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Form/Scheme/FormSchemeBLL.cs @@ -1070,22 +1070,25 @@ namespace Learun.Application.Form string querySql = " SELECT "; if (tableComponts.ContainsKey(tableItem.data.name) && !res.ContainsKey(tableItem.data.name)) { - foreach (var compont in tableComponts[tableItem.data.name]) + DataTable dt = null; + if (tableComponts[tableItem.data.name].Count > 0) { - querySql += compont.field + " , "; - } - - if (string.IsNullOrEmpty(keyValue)) - { - keyValue = pData[tableItem.data.relationField]; - } + foreach (var compont in tableComponts[tableItem.data.name]) + { + querySql += compont.field + " , "; + } - querySql = querySql.Remove(querySql.Length - 2, 2); - querySql += " FROM " + tableItem.data.name + " WHERE " + tableItem.data.field + " = @keyValue"; + if (string.IsNullOrEmpty(keyValue)) + { + keyValue = pData[tableItem.data.relationField]; + } - DataTable dt = databaseLinkIBLL.FindTable(dbId, querySql, new { keyValue = keyValue }); - res.Add(tableItem.data.name, dt); + querySql = querySql.Remove(querySql.Length - 2, 2); + querySql += " FROM " + tableItem.data.name + " WHERE " + tableItem.data.field + " = @keyValue"; + dt = databaseLinkIBLL.FindTable(dbId, querySql, new { keyValue = keyValue }); + res.Add(tableItem.data.name, dt); + } // 获取它的从表数据 if (tableItem.ChildNodes.Count > 0 && dt.Rows.Count > 0) {