var sTableList: TStrings; begin sTableList:=TStringList.Create(); try adoConnection.Connected:=true; adoConnection.GetTableNames(sTableList,false); ShowMessage(sTableList.Text);//显示所有表名 查找表名
创建:create table qq1 (bb c(10),bb1 n) 添加记录:INSERT INTO TABLENAME(FIELD1,FIELD2) VALUES(1,2) 如何判断这张表已经存在: var sTableList: TStrings; begin sTableList:=TStringList.Create(); try adoConnection.Connected:=true; adoConnection.GetTableNames(sTableList,false); ShowMessage(sTableList.Text);//显示所有表名 for i:=0 to flist.count-1 do if 表名=你的表名 THEN 已存在
创建:create table qq1 (bb c(10),bb1 n) 添加记录:INSERT INTO TABLENAME(FIELD1,FIELD2) VALUES(1,2) 如何判断这张表已经存在: var sTableList: TStrings; begin sTableList:=TStringList.Create(); try adoConnection.Connected:=true; adoConnection.GetTableNames(sTableList,false); ShowMessage(sTableList.Text);//显示所有表名 for i:=0 to flist.count-1 do if 表名=你的表名 THEN 已存在
创建:create table qq1 (bb c(10),bb1 n) 添加记录:INSERT INTO TABLENAME(FIELD1,FIELD2) VALUES(1,2) 如何判断这张表已经存在: var sTableList: TStrings; begin sTableList:=TStringList.Create(); try adoConnection.Connected:=true; adoConnection.GetTableNames(sTableList,false); ShowMessage(sTableList.Text);//显示所有表名 for i:=0 to flist.count-1 do if 表名=你的表名 THEN 已存在
with ADOquery do begin close; sql.clear; sql.add('crate table 表名(id smallint)'); execsql; end; with ADOQuery1 do begin Close; SQL.Clear; SQL.Add('alter table 表名 add (ssss varchar(20) null)'); try ExecSQL; except ShowMessage('错误'); end; end;
IF EXISTS (SELECT name FROM sysobjects WHERE name = 'tablename' AND type = 'U') DELETE FROM 'tablename' GO
query1.sql.add('delete from table1 where condition'); query1.sql.execsql;
sTableList: TStrings;
begin
sTableList:=TStringList.Create();
try
adoConnection.Connected:=true;
adoConnection.GetTableNames(sTableList,false);
ShowMessage(sTableList.Text);//显示所有表名
查找表名
添加记录:INSERT INTO TABLENAME(FIELD1,FIELD2) VALUES(1,2)
如何判断这张表已经存在:
var
sTableList: TStrings;
begin
sTableList:=TStringList.Create();
try
adoConnection.Connected:=true;
adoConnection.GetTableNames(sTableList,false);
ShowMessage(sTableList.Text);//显示所有表名
for i:=0 to flist.count-1 do
if 表名=你的表名 THEN 已存在
添加记录:INSERT INTO TABLENAME(FIELD1,FIELD2) VALUES(1,2)
如何判断这张表已经存在:
var
sTableList: TStrings;
begin
sTableList:=TStringList.Create();
try
adoConnection.Connected:=true;
adoConnection.GetTableNames(sTableList,false);
ShowMessage(sTableList.Text);//显示所有表名
for i:=0 to flist.count-1 do
if 表名=你的表名 THEN 已存在
添加记录:INSERT INTO TABLENAME(FIELD1,FIELD2) VALUES(1,2)
如何判断这张表已经存在:
var
sTableList: TStrings;
begin
sTableList:=TStringList.Create();
try
adoConnection.Connected:=true;
adoConnection.GetTableNames(sTableList,false);
ShowMessage(sTableList.Text);//显示所有表名
for i:=0 to flist.count-1 do
if 表名=你的表名 THEN 已存在
begin
close;
sql.clear;
sql.add('crate table 表名(id smallint)');
execsql;
end; with ADOQuery1 do
begin
Close;
SQL.Clear;
SQL.Add('alter table 表名 add (ssss varchar(20) null)');
try
ExecSQL;
except
ShowMessage('错误');
end;
end;
FROM sysobjects
WHERE name = 'tablename' AND type = 'U')
DELETE FROM 'tablename'
GO
query1.sql.execsql;