TFDConnection:

FetchOptions.Mode 设置为fmAll, 返回全部结果, 否则默认只返回前50条, 效果与open以后再执行FetchAll一样

Specifies how the result set records must be fetched into FireDAC internal data storage.

Name Description
fmManual

The records are not fetched automatically by FireDAC. A programmer must write code to fetch records at appropriate times, using the following methods:

fmOnDemand The records are fetched automatically by FireDAC when they are required by the navigation or other dataset methods. At each request FireDAC fetches one or more record sets, containing RowsetSize records.

This mode allows to open large result sets without a significant delay, similarly to the fmAll mode. However, the total time of fetching all records is higher than in fmAll mode. For example, the server-side static cursor is used on Microsoft SQL Server.

fmAll All result set records are fetched automatically by FireDAC at the dataset Open call or at the first IADPhysCommand.Fetch call.

On a large result set it may take some time, but navigation through a dataset is fast because all records are stored in a FireDAC internal data storage. For many DBMSs, such as Microsoft SQL Server, MySQL Server, Sybase SQL Anywhere:

  • It releases client result set buffer and allows to execute the next command returning result sets.
  • It gives maximum fetch performance. For example, the fast forward-only cursor is used on Microsoft SQL Server.

ResourceOptions.SilentMode 设置为True, 就不需要FDGUIxWaitCursor之类的东西了, 同样也不再会自动改变鼠标样式, 默认是需要的

Controls the dataset GUI feedback.

Use the SilentMode property to control whether the dataset shows the SQL-hourglass mouse cursor when the dataset performs potentially long running actions. The dataset will show the SQL-hourglass if it is set to False. Otherwise, it is set to True. By default, it is set to False. For TFDCustomMemTable, it is set to True.

Setting SilentMode to True allows you to speed up the dataset processing algorithms.

TFDQuery:

ResourceOptions.DirectExecute 设置为True, 直接执行SQL, 默认是False, 在某些数据库(比如Postgre) 如果设置为False那么在执行多条SQL的时候会报错....

Controls the preparation of SQL statements.

Use the DirectExecute property to specify whether FireDAC should prepare an SQL statement before its execution (False) or execute it directly (True). The default value is False.

This property was introduced at first for MS SQL Server support. The prepared and the direct execution may have different effects, and even the prepared execution may fail. If you will get peculiar errors, then try to set DirectExecute to True.

FetchOptions.AutoClose := False; 不要自动关闭连接...这个如果不设置的话, 多结果集返回的时候会出问题....

Controls the automatic closing of a dataset cursor after fetching the last record.

Use the AutoClose property value to control the automatic closing of a dataset cursor.  If AutoClose is set to True and the last record is fetched from the current result set, then the underlying cursor is closed, all additional result sets that have not been yet processed are discarded, and the resources associated with the cursors are released. The dataset (TFDDataSet descendant) itself is closed, but its internal command object is closed. This allows the release of DBMS resources associated with a cursor as fast as possible.

If your SQL command returns several result sets and you need to process all of them, then you must set AutoClose to False. Otherwise, after processing the first result set, all other result sets are discarded.

The default value is True.

 FDPhysMSSQLDriverLink:

ODBCDriver 连接SQL Server的驱动, 如果系统里有多个版本的SQL Server, 默认会使用最高版本的那个

    ODBCDriver := FindBestDriver([C__NC, C__ODBC, C_, C_, C_])

但是, 如果你要使用的数据库是2000, 而机器里有更高版本的数据库, 那么使用Native连接2000的时候就会出现各种奇怪的问题(比如无法同时edit2个超过1024k的二进制字段等)

所以如果有可能, 最好在创建连接的时候指定ODBCDriver

----暂时这些, 想到或遇到时再增加----

FireDAC 连接SQL Server一些要注意的地方的更多相关文章

  1. FireDAC 连接SQL Server一些要注意的地方(转)

    TFDConnection: FetchOptions.Mode 设置为fmAll, 返回全部结果, 否则默认只返回前50条, 效果与open以后再执行FetchAll一样 Specifies how ...

  2. firedac odbc sql server driver连接占线导致另一个hstmt

    firedac odbc sql server driver连接占线导致另一个hstmt 原因:FDQuery.FetchOptions.Mode=fmOnDemand.好像是为了性能问题,不设置则默 ...

  3. Unity3d连接SQL Server数据库出现SocketException: 使用了与请求的协议不兼容的地址错误

    这两天,同学问我Unity3d连接SQL Server的问题,当时我只是简单的说:“应该一样吧,就是那简单的几句啊”.之后他让我试了下,我才发现有问题了.故此写下一篇博客,要牢记这件事的教训,操作数据 ...

  4. vbs连接sql server及写文件操作

    此段代码是连接SQL SERVER的 代码内connMMSQL的参数要根据实际情况传入 Function connMMSQL(ip,user,pwd,database,strsql) Dim conn ...

  5. python 使用pymssql连接sql server数据库

    python 使用pymssql连接sql server数据库   #coding=utf-8 #!/usr/bin/env python#------------------------------ ...

  6. NetBeans连接SQL server数据库教程

    不废话,直接开始 1.下载sqljdbc.jar 可以从微软中国官方网站下载 SQLJDBC微软中国 笔者提供一个网盘链接Sqljdbc.jar 4个压缩包视版本选择,SQL 2012 用sqljdb ...

  7. JDBC连接SQL Server代码模板

    *                  JDBC连接SQL Server数据库 代码模板* Connection: 连接数据库并担任传送数据的任务:* Statement :  执行SQL语句:* Re ...

  8. 【转】PowerShell 连接SQL Server 数据库 - ADO.NET

    转至:http://www.pstips.net/connect-sql-database.html PowerShell 通过ADO.NET连接SQL Server数据库,并执行SQL脚本.工作中整 ...

  9. PHP5.6.15连接Sql Server 2008配置方案

    php5.6的如果想连接Sql Server 2008数据库,需要手动配置扩展和安装一个驱动. 下载SQL Server Driver for PHP的扩展包,64位系统的官方不支持,找到一个非官方的 ...

随机推荐

  1. Oracle分析函数(一)

    一.总体介绍 分析函数如何工作 语法 FUNCTION_NAME(<参数>,…) OVER (<PARTITION BY 表达式,…> <ORDER BY 表达式 < ...

  2. [Linux]系统调用理解(3)

    本文介绍了Linux下的进程的一些概念,并着重讲解了与Linux进程管理相关的重要系统调用wait,waitpid和exec函数族,辅助一些例程说明了它们的特点和使用方法. 1.7 背景 在前面的文章 ...

  3. WPF 线程 Dispatcher

    WPF 应用程序从两个线程开始: 一个用于处理呈现 一个用于管理 UI 呈现线程有效地隐藏在后台运行,而UI线程则接收输入.处理事件.绘制屏幕以及运行应用程序代码. 大多数应用程序都使用一个 UI 线 ...

  4. Python字符串倒序-7. Reverse Integer

    今天做了下LeetCode上面字符串倒序的题目,突然想Python中字符串倒序都有哪些方法,于是网上查了下,居然有这么多种方法: 个人觉得,第二种方法是最容易想到的,因为List中的reverse方法 ...

  5. BubbleSort冒泡排序

    #include <stdio.h>void BubbleSort(int *a,int n);int main(void){ int arr[10] = {2,4,6,8,0,1,3,5 ...

  6. MongoDB的ObjectId和基本操作增删改查(3)

    ObjectId 基本操作增删改查 增: insert 介绍: mongodb存储的是文档,. 文档是json格式的对象. 语法: db.collectionName.insert(document) ...

  7. 一个请求在Struts2框架中的处理流程

    1.客户端向Servlet容器发起一个请求,将请求封装为HttpServletRequest对象. 2.HttpServletRequest首先经过web.xml中配置的struts2的过滤器,以及s ...

  8. JavaScript(一)

    JavaScript 是脚本语言 JavaScript 是一种可插入 HTML 页面的轻量级的编程语言,它跟Java没有什么蛋关系. JavaScript使用: <script language ...

  9. 朋友圈常见单页面触屏滑动上下翻屏功能jQuery实现

    翻页插件:实现原理,用margin-top来控制页面容器位置来实现上下翻页.margin这属性很好用,可以用来制作侧栏动画滑出菜单(左菜单,右内容,控制两者的margin实现):或者head下滑菜单 ...

  10. Objective-C 中self.与_访问方式的区别

    Objective-C中属性self.a与_a访问的区别: 在OC中我们可以通过指令@property定义属性. OC对属性封装了许多方法,同时也会自动实现一些方法,相比实例变量,感觉更加面向对象些. ...