http://www.delphibbs.com/delphibbs/dispq.asp?lid=1601151 建表: Create Table Tab1 ( ID Counter, Name string, Age integer, [Date] DateTime); 技巧: 自增字段用 Counter 声明. 字段名为关键字的字段用方括号[]括起来,数字作为字段名也可行.
with ADOQuery1 do begin close; sql.clear; sql.add('create table Type2('); sql.add('ID int identity,'); sql.add('ParentID string,'); sql.add('Name VarChar(32) NOT NULL,'); sql.add('primary key (ID))'); execsql; end;
建表:
Create Table Tab1 (
ID Counter,
Name string,
Age integer,
[Date] DateTime);
技巧:
自增字段用 Counter 声明.
字段名为关键字的字段用方括号[]括起来,数字作为字段名也可行.
begin
close;
sql.clear;
sql.add('create table Type2(');
sql.add('ID int identity,');
sql.add('ParentID string,');
sql.add('Name VarChar(32) NOT NULL,');
sql.add('primary key (ID))');
execsql;
end;