用sql + Ado设置access的字段的默认值
procedure TFormLOrder.ModifyDB; var F: Integer; begin with TADOQuery.Create( nil ) do try // ConnectionString := GetAdoAccConStr(SoftPath + SendDataDir +LogisOrderDB); Connection := ADOCon; SQL.Add( ' Select * from ' + tblogistics_orders);
<span>procedure</span><span> TFormLOrder.ModifyDB; </span><span>var</span><span> F: Integer; </span><span>begin</span> <span>with</span> TADOQuery.Create(<span>nil</span>) <span>do</span> <span>try</span> <span>//</span><span> ConnectionString := GetAdoAccConStr(SoftPath + SendDataDir +LogisOrderDB);</span> Connection :=<span> ADOCon; SQL.Add(</span><span>'</span><span>Select * from </span><span>'</span> +<span> tblogistics_orders); //不能用 Select seller_flag from ,否则会报 参数 seller_flag 没有默认值 Open; </span><span>if</span> FieldList.Find(<span>'</span><span>seller_flag</span><span>'</span>) = <span>nil</span> <span>then //不能用 FieldByName,因为参数必须是存在的字段,否则会产生异常</span> <span>begin</span><span> Close; SQL.Clear; SQL.Add(</span><span>'</span><span>ALTER TABLE </span><span>'</span> +<span> tblogistics_orders); SQL.Add(</span><span>'</span><span>ADD COLUMN seller_flag INTEGER DEFAULT 0</span><span>'</span><span>); </span><span>//</span><span> ADOCon.Execute(sql.Text, F); //这个也可以的,并 不是 必须用这个</span> <span> ExecSQL; </span><span>end</span><span>; </span><span>// </span><span> Close; sql.Clear; sql.Add(</span><span>'</span><span>Select sub_tids from </span><span>'</span> +<span> tblogistics_orders); Open; </span><span>if</span> (FieldCount > <span>0</span>) <span>and</span> (FieldByName(<span>'</span><span>sub_tids</span><span>'</span>).Size 255) <span>then</span> <span>begin</span><span> Close; SQL.Clear; sql.Add(</span><span>'</span><span>ALTER TABLE </span><span>'</span> +<span> tblogistics_orders); SQL.Add(</span><span>'</span><span>ALTER COLUMN sub_tids TEXT(255)</span><span>'</span>); <span>//</span><span>换行的话,前面不用加 空格</span> <span> ExecSQL; </span><span>//</span><span> if RowsAffected > 0 then</span><span> //</span><span> ShowMessage('');</span> <span>end</span><span>; </span><span>finally</span><span> Free </span><span>end</span><span>; </span><span>end</span>;
http://www.jb51.net/article/990.htm
http://m.blog.csdn.net/blog/xijupony/5741707
<span><span>[原]Access里的Alter Table </span><span>2010</span>-<span>7</span>-<span>17</span><span>阅读1925 评论0 ASP连接ACCESS数据库通常有两种方法 </span><span>1</span>. "DRIVER=<span>{</span><span>Microsoft Access Driver (*.mdb)</span><span>}</span>;DBQ=<span>[数据库地址]" </span><span>2</span>. "Provider=Microsoft.Jet.OLEDB.<span>4.0</span>;Data Source=<span>[数据库地址]" 第一种连接方式使用的是“ANSI SQL”,第二种为Microsoft Jet 数据库引擎。而Microsoft Jet 数据库引擎限制较少,例如,它允许在表达式中进行分组和排序,且提供了更强有力的表达式。诸如:CREATE TABLE、ALTER TABLE的在MS SQLSERVER数据库经常用到的更新数据表的SQL语句。 因此,推荐使用第二种数据连接方式。 以下是今天使用ALTER TABLE的一些心得。 语法:ALTER TABLE 表 ADD COLUMN 字段类型 [(字长)] [NOT NULL] [DEFAULT (VALUES)] [CONSTRAINT 索引] </span>|<span> ALTER COLUMN 字段类型 [(字长)] </span>|<span> CONSTRAINT 多重字段索引 } </span>|<span> DROP DROP</span><span>{</span><span>COLUMN 字段 I CONSTRAINT 索引名 </span><span>}</span><span> } 上面的语法资料出自《Microsoft Jet SQL 参考》,但其中并没有[DEFAULT (VALUES)]这一参数。经实验,DEFAULT设置默认值的参数完全是有效的。 但需要注意的是,NOT NULL</span>|NULL 不区分大小写。DEFAULT则区分,小写的"<span>default</span><span>"不是Jet SQL的关键字,并不起效。 附:《Microsoft Jet SQL 参考》,这是开发ACCESS的好帮助文档,值得推荐。</span></span>
http://linux.chinaunix.net/techdoc/database/2005/12/14/925763.shtml
http://www.cnblogs.com/luckboy/archive/2009/11/21/1607564.html

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











How to configure Zend in Apache? The steps to configure Zend Framework in an Apache Web Server are as follows: Install Zend Framework and extract it into the Web Server directory. Create a .htaccess file. Create the Zend application directory and add the index.php file. Configure the Zend application (application.ini). Restart the Apache Web server.

VprocesserazrabotkiveB-enclosed, Мнепришлостольностьсясзадачейтерациигооглапидляпапакробоглесхетсigootrive. LEAVALLYSUMBALLANCEFRIABLANCEFAUMDOPTOMATIFICATION, ČtookazaLovnetakProsto, Kakaožidal.Posenesko

Effective monitoring and defense against malicious website access is crucial to the Apache server on the Debian system. Apache access logs are the key source of information to identify such threats. This article will guide you on how to analyze logs and take defensive measures. The Apache access log that identifies malicious access behaviors Debian systems is usually located in /var/log/apache2/access.log. You can analyze the logs in a variety of ways: Log file location confirmation: First, please confirm the exact location of your Apache access log, which may vary slightly depending on the system configuration. Command line tool analysis: Use grep command to search for specific patterns, such as grep "404"

Nginx performance monitoring and troubleshooting are mainly carried out through the following steps: 1. Use nginx-V to view version information, and enable the stub_status module to monitor the number of active connections, requests and cache hit rate; 2. Use top command to monitor system resource occupation, iostat and vmstat monitor disk I/O and memory usage respectively; 3. Use tcpdump to capture packets to analyze network traffic and troubleshoot network connection problems; 4. Properly configure the number of worker processes to avoid insufficient concurrent processing capabilities or excessive process context switching overhead; 5. Correctly configure Nginx cache to avoid improper cache size settings; 6. By analyzing Nginx logs, such as using awk and grep commands or ELK

Apache server is a powerful web server software that acts as a bridge between browsers and website servers. 1. It handles HTTP requests and returns web page content based on requests; 2. Modular design allows extended functions, such as support for SSL encryption and dynamic web pages; 3. Configuration files (such as virtual host configurations) need to be carefully set to avoid security vulnerabilities, and optimize performance parameters, such as thread count and timeout time, in order to build high-performance and secure web applications.

This article will explain how to improve website performance by analyzing Apache logs under the Debian system. 1. Log Analysis Basics Apache log records the detailed information of all HTTP requests, including IP address, timestamp, request URL, HTTP method and response code. In Debian systems, these logs are usually located in the /var/log/apache2/access.log and /var/log/apache2/error.log directories. Understanding the log structure is the first step in effective analysis. 2. Log analysis tool You can use a variety of tools to analyze Apache logs: Command line tools: grep, awk, sed and other command line tools.

The Nginx current limit problem can be solved by: use ngx_http_limit_req_module to limit the number of requests; use ngx_http_limit_conn_module to limit the number of connections; use third-party modules (ngx_http_limit_connections_module, ngx_http_limit_rate_module, ngx_http_access_module) to implement more current limit policies; use cloud services (Cloudflare, Google Cloud Rate Limiting, AWS WAF) to DD

This article describes how to analyze Nginx logs to improve website performance and user experience. 1. Understand the Nginx log format, such as timestamps, IP addresses, status codes, etc.; 2. Use tools such as awk to parse logs and count indicators such as visits, error rates, etc.; 3. Write more complex scripts according to needs or use more advanced tools, such as goaccess, to analyze data from different dimensions; 4. For massive logs, consider using distributed frameworks such as Hadoop or Spark. By analyzing logs, you can identify website access patterns, improve content strategies, and ultimately optimize website performance and user experience.
