Q:MaxLength limit

Cannot set column ‘push_name’. The value violates the MaxLength limit of this column.

无法设置列“push_name”。该值违反了此列的MaxLength限制。

A:给列指定长度,必须考虑最大长度

E:\0_RG\Code\RG6.PF\rg3-pf\RG3.BO.DB\Services\DbSqlService$ResDoName.cs

 if (sqlConfig.ResponseFieldTemp.Field.DoName == null) return;
            var doNames = sqlConfig.ResponseFieldTemp.Field.DoName;
            foreach (string key in doNames.Keys)
            {
                string name = doNames[key].OrderBy(t => t.SortId).ToList()[0].Name;
                if (!dtAll.Columns.Contains(name)) dtAll.Columns.Add(name);
                var len = dtAll.Columns[name].MaxLength;
                //避免长度不够导致错误
                if (len > 80) continue;
                dtAll.Columns[name].MaxLength = 80;
            }
文档更新时间: 2023-06-12 09:46   作者:admin