我刚刚也碰到这个问题,我把两者分开来对待。
使用Access时先用AdoConnection来取得表名,然后判断是否要创建表。
使用Sql可以使用语句
IF NOT EXISTS (SELECT name
FROM sysobjects
WHERE name = N'RationItem'
AND type = 'U')
CREATE TABLE RationItem
使用Access时先用AdoConnection来取得表名,然后判断是否要创建表。
使用Sql可以使用语句
IF NOT EXISTS (SELECT name
FROM sysobjects
WHERE name = N'RationItem'
AND type = 'U')
CREATE TABLE RationItem
解决方案 »
- 帮忙给看看关于映射的代码吧,初学内存映射
- ListView问题?
- 渐渐的喜欢上零晨1,2点的感觉
- 关于rave报表使用的问题
- adoquery 用insert插入,最前面的零不见了
- 用Timage装载了图片,是否要位图才能用编辑呢,急啊
- delphi组件问题!
- 怎样得到目前屏幕上最上面的窗口,就是alt+printscreen能抓住的那个窗口。
- 有没有能够代替CoolBar和ControlBar控件的更好的控件?功能更完善---------------谢谢!
- 如何用代码,将VISTA外观设置中的 AERO玻璃 切换为 VISTA 基本
- 怎样得到硬盘的分区数和一些基本情况
- 在TIDTcpServer构件时的一个奇怪问题???!!!解答者加分
IF NOT EXISTS (SELECT name
FROM sysobjects
WHERE name = N'RationItem'
AND type = 'U')
CREATE TABLE RationItem
然后,这个表就一定存在了!过年了,即使得不到我所需的答案, 大家开心了也不错.
呵呵.
分算什么东西.快乐才是最重要的!还有一个270分的问题,其实不是技术问题,只是一个常识问题, 此问题每一个小时增加10分,每个U..P者均有分!
http://www.csdn.net/Expert/topic/497/497690.shtm
OpenSchema(const Schema: TSchemaInfo; const Restrictions: OleVariant;
const SchemaID: OleVariant; DataSet: TADODataSet);
var
adoconnection:Tadoconnection;
strtable:Tstringlist;
i:integer;
Bfind:boolean;
begin
strbable:=Tstringlist.create;
adoconnection:=Tadoconnection.create(self);
adoconnection.gettablenames(strtable,false);
bfind:=false;
for i:=0 to strtable.items.count do
beign
if strtable.strings[i]=表名 then
bfind:=true;
end;
if bfind then
....
adoconnection:Tadoconnection;
strtable:Tstringlist;
i:integer;
Bfind:boolean;
begin
strbable:=Tstringlist.create;
adoconnection:=Tadoconnection.create(self);
adoconnection.gettablenames(strtable,false);
bfind:=false;
if strtable.find(表名,i) then
shwomessage('找到')
else
showmessage('没找到');
adoconnection.free;//或者
for i:=0 to strtable.items.count do 改为for i:=0 to strtable.items.count-1 do
beign
if strtable.strings[i]=表名 then
bfind:=true;
end;
if bfind then
....