FireDAC FDQuery
http://docwiki.embarcadero.com/RADStudio/XE6/en/Editing_Questions_%28FireDAC%29
http://docs.embarcadero.com/products/rad_studio/firedac/frames.html?frmname=topic&frmfile=index.html
TFDMemTable is faster than TClientDataSet.
FDQuery.OpenOrExecute
FDQuery Params
FDQuery->ParamByName("kl")->Value = edtkl->Text;
FDQuery->Params->Items[0]->Value = cboyhmc->Text;
FDQuery->Params->operator[](0)->Value = 0;
FDConnection1.SQL("INSERT INTO MyTable(Name, Age) VALUES(:name, :age)", [""AAA"", 11]);
FDConnection1.SQLScalar(""SELECT Age FROM MyTable WHERE Name = :x"", [""BBB""]);
FDMemTable1.CopyDataSet(DataSet1, [coStructure, coRestart, coAppend]);
copy all records from FDQuery into FDMemTable
FDQuery1.FetchOptions.Undirectional := False;
FDQuery1.Open;
FDQuery1.FetchAll;
FDMemTable1.Data := FDQuery1.Data;
remove dataset records without removing them from the database
A: You can work directly with internal dataset data storage. It is accessible through TFDDataSet.Table property. For example, to delete the row with index 3 do the following:
FDQuery1.Table.Rows[3].Free;
FDQuery1.UpdateCursorPos;
FDQuery1.Resync([]);
For example, to delete the current record, do the following:
FDQuery1.UpdateCursorPos;
FDQuery1.GetRow.Free;
FDQuery1.UpdateCursorPos;
FDQuery1.Resync([]);
Assigning TField.CustomConstraint does not work. What is wrong?
Q: Appending constraint via:
FDQuery.FieldByName('FIELD_NAME').CustomConstraint := 'FIELD_NAME > 1';
FDQuery.UpdateConstraints;
FDQuery.Table.Constraints.Check(FDQuery.GetRow(), rsModified, ctAtEditEnd);
Is not working and an exception is not raised.
A: That is OK (explanation will follow).
Q: But:
FDQuery.Constraints.Add.CustomConstraint := 'FIELD_NAME > 1';
FDQuery.UpdateConstraints;
FDQuery.Table.Constraints.Check(FDQuery.GetRow(), rsModified, ctAtEditEnd);
Is working! Why?
A: Also OK.
Q: What exactly do ctAtEditEnd and ctAtColumnChange mean?
A: These enums are specifying the event when FireDAC should check constraints:
- ctAtEditEnd - the Post is called
- ctAtColumnChange - a field value is modified
Now the explanation:
FDQuery.FieldByName('FIELD_NAME').CustomConstraint := 'FIELD_NAME > 1';
This adds a field-level constraint. They are checked at ctAtColumnChange event only.
FDQuery.Constraints.Add.CustomConstraint := 'FIELD_NAME > 1';
This adds a record-level constraint. They are checked at ctAtEditEnd event only.
FDQuery1.Command.CommandKind := skInsert;
FDQuery1.ExecSQL;
FDQuery带参数Open
FDQuery1.Open('select * from tt where id=:id',[0]);
Variant locvalues[1];
locvalues[0] = Variant("01");
FDQuery1->Open("select * from table where id=:id", locvalues, 0);
FireDAC FDQuery的更多相关文章
- 怎样提交FIREDAC数据集的DELTA到中间件然后保存进数据库
你可以在客户端序列FireDAC数据集的DELTA , 将序列后的STREAM发送给中间件, 中间件的TFDQuery或TFDMemTable调用LOADFROMSTREAM()方法加载流, 然后调用 ...
- 一个例子说明如何在DataSnap中使用FireDAC
一.FireDAC调用DataSnap远程方法查询数据示例 1.服务端使用FDQUERY查询数据并返回TDATASET: function TServerMethods1.GetData(var sq ...
- DataSnap 多层返回数据集分析FireDAC JSON
采用服务器返回数据,一种是返回字符串数据例如JSON,跨平台跨语言,任何语言调用都支持兼容,类似WEBService. 第二种是紧密结合c++builder语言,传输DataSet,可以是Client ...
- FDQuery 怎么能插入NULL参数
[FireDAC][Phys][MSSQL]-335. Parameter [fieldAA] data type is unknown. Hint: specify TFDParam.DataTyp ...
- FireDac 组件说明一
TFDManager 连接定义和Connect连接管理 TFDConnection 数据库连接组件,支持三种连接方式:1.持久定义(有一个唯一名称和一个配置文件,可以由FDManager管理) 例: ...
- 调用DATASNAP+FIREDAC的远程方法有时会执行二次SQL或存储过程的BUG(转永喃兄)
调用DATASNAP+FIREDAC的远程方法有时会执行二次SQL或存储过程的BUG 1)查询会重复执行的情形:Result := DATASETPROVIDER.Data会触发它关联的DATASET ...
- firedac调用ORACLE的存储过程
firedac调用ORACLE的存储过程 EMB官方原文地址:http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Using_Oracle_with_F ...
- FireDAC中的SQLite(二)
我们接下来将要使用FDDemo.sdb数据库进行访问,开始我们的第一个SQLite访问例子. 我们的FDDemo.sdb存放目录在:C:\Program Files (x86)\Embarcadero ...
- FDQuery sqlserver 临时表
用FDQuery执行创建临时表,查不到临时表,用ADOQuery和BDEQuery均正常,比较发现用ADOQuery执行的时候只有SQL没有调用sql的系统存储过程sp_prepexec. 是fdqu ...
随机推荐
- LG2521 [HAOI2011]防线修建
题意 题目描述 近来A国和B国的矛盾激化,为了预防不测,A国准备修建一条长长的防线,当然修建防线的话,肯定要把需要保护的城市修在防线内部了.可是A国上层现在还犹豫不决,到底该把哪些城市作为保护对象呢? ...
- streamsets 集成 rabbitmq 以及benthos stream 处理框架
benthos 是一个stream 处理框架,streamsets 也是,但是两者可以通过不同的工具进行集成起来 一般我们可以使用http 服务,消息中间件(kafka.rabbitmq ...) 使 ...
- OpenWrt的web服务器
参考: http://www.szchehang.com/news/10602.html 我们登录的路由器主界面就是通过这个软件指定了80端口来访问的.我们要添加自己额外的网站服务,那只需要重新定义一 ...
- bat文件:启动,休眠VBox虚拟机
1. start.Xp_Mysql.bat @echo cd D:\Program Files\VirtualBox\ D: .\VBoxManage startvm Xp_Mysql --type ...
- 在ASP.NET应用程序中使用身份模拟(Impersonation)
摘要 缺省情况下,ASP.NET应用程序以本机的ASPNET帐号运行,该帐号属于普通用户组,权限受到一定的限制,以保障ASP.NET应用程序运行的安全.但是有时需要某个ASP.NET应用程序或者程 ...
- 从c#数组求和说起
c#是一种玩具语言 为什么这么说, 举个简单的例子,提问:对数组[1,2,3]求和有几种方法? 我能说出来的,四种.说出来,不是上网查出来. for,foreach,sum,while. for好像大 ...
- pycharm中配置pep8
Pycharm本身是有pep8风格检测的,当你敲得代码中不符合规范时,会有下划波浪线提示.如何让代码修改为符合规范,去掉这些难看的波浪线呢? 1.安装autopep8 pip install aut ...
- PHP include 和 require 语句 (调用其他php文件进来的方法)
PHP include 和 require 语句通过 include 或 require 语句,可以将 PHP 文件的内容插入另一个 PHP 文件(在服务器执行它之前). require 会生成致命错 ...
- 求交错序列前N项和(15 分)
7-2 求交错序列前N项和(15 分) 本题要求编写程序,计算交错序列 1-2/3+3/5-4/7+5/9-6/11+... 的前N项之和. 输入格式: 输入在一行中给出一个正整数N. 输出格式: 在 ...
- 通过Vim+少量插件配置一个高效简洁的IDE
最近本人在看<TCP/IP Illustrated Volume2:The Implementation>这本书,自然要下载4.4BSD-Lite的源代码配合书本一起研读.以前学习Vim的 ...