给一个数据源adoquery1连上那个数据库,然后: 在一个button上写下如下代码: begin with adoquery1 do begin sql.clear; sql.add('create table 表名(字段名 字段类型)'); execsql; end; end; ok, 一个新表诞生了
var newtable:ttable; newindexoptions:tindexoptions; begin …… newindexoptions:=[ixprimary,ixunique]; …… newtable.indexdefs.add('primaryindex,"添加的 index",newindexoptions); …… createtable; end; 这样就能建立主键,并且是唯一的。
Qry.Close;
Qry.SQL.Text := 'create talbe ......';
Qry.ExecSql;
select * into tableName from ...
ADOConnection.Execute('Create Table 表名(字段名 字段类型')字段类型 char,int,date等
Create table tab(f1 int,f2 char(20))
在一个button上写下如下代码:
begin
with adoquery1 do
begin
sql.clear;
sql.add('create table 表名(字段名 字段类型)');
execsql;
end;
end;
ok, 一个新表诞生了
newtable:ttable;
newindexoptions:tindexoptions;
begin
……
newindexoptions:=[ixprimary,ixunique];
……
newtable.indexdefs.add('primaryindex,"添加的 index",newindexoptions);
……
createtable;
end;
这样就能建立主键,并且是唯一的。