TClientDataSet 提交时提示 Field value Required 但是未提示具体哪个字段。
TClientDataSet 提交时提示 Field value Required 但是未提示具体哪个字段。
这个错误特别麻烦,要使用 midas 控件时,虽然很方便。但是出错了根本找不到原因,特别是这个异常。
下面的补丁,可以帮助找到错误原因。
注:我们自己在使用的时候,采用了控件继承,因此可以把这个功能变成控件基本功能,但是继承相关代码特别多,就不在这里贴了。
procedure postAndCheckValue(ds: TDataSet);
var
I: Integer;
curField: TField;
strField: TStringField;
begin
try
ds.Post;
except
on E: EDBClient do begin
if E.Message = 'Field value required.' then begin
for I := to ds.Fields.Count - do begin
curField := ds.Fields[I];
if curField.Required and ds.Fields[I].IsNull then
raise EDBClient.Create('必要的数据项“' + ds.Fields[I].DisplayLabel + '”为空值!', E.ErrorCode); if curField.Required and (curField is TStringField) then begin
strField := curField as TStringField;
if strField.FixedChar and (strField.AsString = '') then
raise EDBClient.Create('必要的数据项“' + ds.Fields[I].DisplayLabel + '”为空值!', E.ErrorCode);
end;
end;
end;
raise;
end;
end;
end;
调用时,如果出错。就用这个进行提交即可:
myDataSet.append; postAndCheckValue(myDataSet);
TClientDataSet 提交时提示 Field value Required 但是未提示具体哪个字段。的更多相关文章
- SpringBoot 启动的时候提示 Field *** in *** required a bean named 'entityManagerFactory' that could not be found.
错误截图 后面发现原来和入口类代码有关. //@SpringBootApplication(scanBasePackages = {"org.jzc.odata.cboard",& ...
- Git提交时提示‘The file will have its original line endings in your working directory’
Git提交时提示'The file will have its original line endings in your working directory' Git出现错误 git add -A ...
- easyui form提交时验证必填,打开时不显示必填提示
给textbox添加required:true属性后,打开页面时整个表单都是红的,需要将其设置为提交时再验证. 解决方法:通过textbox的novalidate属性来控制是否开启验证 <inp ...
- svn提交时提示 Aborting commit: remains in conflict 解决办法,更改svn服务地址
TortoiseSVN客户端如何更改新的URL 问题: 我们的服务器换了新的URL地址,这时候我们本地的SVN访问帐号和地址就要重新定义了. 解决步骤: 1:重新定义SVN的URL,右键(Tortoi ...
- svn提交时提示 Aborting commit: remains in conflict 解决办法
出现在rename一个目录时,再提交时一直报错 Aborting commit: remains in conflict 使用右键菜单 svn - resolve 即可解决.用cleanup之类的都没 ...
- SVN hooks强制提交时填写日志
#!/bin/bash REPOS="$1" TXN="$2" #svnlook路径 SVNLOOK=/usr/bin/svnlook #通过svnlook获取 ...
- SVN、Git设置提交时忽略的文件
个人正在使用的:global-ignores = *.o *.lo *.la *.al .libs *.so *.so.[0-9]* *.pyc *.pyo [Tt]humbs.db [Bb]in [ ...
- SVN更新或提交时出现冲突该如何解决
解决版本冲突的命令.在冲突解决之后,需要使用svnresolved来告诉subversion冲突解决,这样才能提交更新.冲突发生时,subversion会在WorkCopy中保存所有的目标文件版本(上 ...
- jQuery判断 form表单提交时一些文本框的判断
一: form表单提交时如果表单里有input标签为空那么不提交form表单. <head> <script type="text/javascript"> ...
随机推荐
- Flutter Dart中的异步
以下内容从官网得到: https://webdev.dartlang.org/articles/performance/event-loop Even-Looper Dart是单线程模型,也就没有了所 ...
- Flutter dart:convert
引用 mport 'dart:convert'; JSON 解码(JSON String->Object) // NOTE: Be sure to use double quotes (&quo ...
- [Android] 对自定义图片浏览器经常内存溢出的一些优化
首先关于异步加载图片可以参见 夏安明 的博客:http://blog.csdn.net/xiaanming/article/details/9825113 这篇文章最近有了新的更改,大概看了一下,内容 ...
- 【python】字典/dictionary操作
字典(dictionary) 字典是另一种可变容器模型,且可存储任意类型对象. 字典的每个键值 key=>value 对用冒号:分割,每个键值对之间用逗号,分割,整个字典包括在花括号 {} 中 ...
- git版本超前了N个版本且落后了N个版本的解决办法
当遇到该问题的时候,一般情况下我们会首先拉取,紧接着就出现了一系列问题………… 其实当输入命令,git pull的时候,会报错,这时瞬间就感到凌乱了&……*%%*%………… 莫慌…… 这时输入 ...
- sql server 用户'sa'登录失败(错误18456)
转载于:http://thenear.blog.51cto.com/4686262/865544 用户'sa'登录失败(错误18456)解决方案图解 当我们在使用sql server 的时候可 ...
- 详解Oracle DELETE和TRUNCATE 的区别
原文地址:http://www.cnblogs.com/simplefrog/archive/2012/07/30/2615169.html 语法delete from aa truncate tab ...
- ZooKeeper 分布式协调服务介绍
0. 说明 从自己的独立博客迁移,该部分为 Zookeeper分布式协调服务介绍 原文链接 ZooKeeper 指南 1. ZooKeeper 简介 [官方介绍] ZooKeeper 是一种集中式服 ...
- MySQL基础之 支持的数据类型
MySQL的数值类型 整数类型 字节 有符号 无符号 TINYINT 1 -128~+127 0~255 SAMLLINT 2 -32768~+32767 0~65535 MEDIUMINT 3 -8 ...
- sql注入--access
access数据库结构: 表名 --> 列名 --> 数据 access注入攻击片段 联合查询法: (1) 判断注入点: ?id=1 and 1=1 ; ?id=1 and 1 ...