用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

AI Hentai Generator
Generate AI Hentai for free.

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



The advantage of multithreading is that it can improve performance and resource utilization, especially for processing large amounts of data or performing time-consuming operations. It allows multiple tasks to be performed simultaneously, improving efficiency. However, too many threads can lead to performance degradation, so you need to carefully select the number of threads based on the number of CPU cores and task characteristics. In addition, multi-threaded programming involves challenges such as deadlock and race conditions, which need to be solved using synchronization mechanisms, and requires solid knowledge of concurrent programming, weighing the pros and cons and using them with caution.

How to avoid the third-party interface returning 403 error in the Node environment. When calling the third-party website interface using Node.js, you sometimes encounter the problem of returning 403 error. �...

The main reasons why you cannot log in to MySQL as root are permission problems, configuration file errors, password inconsistent, socket file problems, or firewall interception. The solution includes: check whether the bind-address parameter in the configuration file is configured correctly. Check whether the root user permissions have been modified or deleted and reset. Verify that the password is accurate, including case and special characters. Check socket file permission settings and paths. Check that the firewall blocks connections to the MySQL server.

SQL IF statements are used to conditionally execute SQL statements, with the syntax as: IF (condition) THEN {statement} ELSE {statement} END IF;. The condition can be any valid SQL expression, and if the condition is true, execute the THEN clause; if the condition is false, execute the ELSE clause. IF statements can be nested, allowing for more complex conditional checks.

Get ComponentVerify in EasyWechat5.5...

As a data professional, you need to process large amounts of data from various sources. This can pose challenges to data management and analysis. Fortunately, two AWS services can help: AWS Glue and Amazon Athena.

MySQL and SQL are essential skills for developers. 1.MySQL is an open source relational database management system, and SQL is the standard language used to manage and operate databases. 2.MySQL supports multiple storage engines through efficient data storage and retrieval functions, and SQL completes complex data operations through simple statements. 3. Examples of usage include basic queries and advanced queries, such as filtering and sorting by condition. 4. Common errors include syntax errors and performance issues, which can be optimized by checking SQL statements and using EXPLAIN commands. 5. Performance optimization techniques include using indexes, avoiding full table scanning, optimizing JOIN operations and improving code readability.

Methods to solve the cross-domain problem of Vue Axios include: Configuring the CORS header on the server side using the Axios proxy using JSONP using WebSocket using the CORS plug-in
