一点心得:在 Delphi 中使用原生 ADO 控制数据库,班门弄斧了 ( 积分: 100 )

  • 主题发起人 主题发起人 vvyang
  • 开始时间 开始时间
楼主原来是做c++或者vb的,一直用delphi的人很少能想到创建原生ado。

感谢楼主的帖子,本人很希望能把这几个函数做成类。做好后发到上面来……
 
好 呵呵
-----------------------
http://www.coderpub.com 技术论坛
 
ADO觉得很好,只是感觉有时不稳定。速度也慢
 
to vvyang:
你好,我想请教一下,用ADO动态生成access数据库,如果数据库里有备注字段怎么生成。还是,没有办法生成。网上的都是用SQL建立数据库还有其他方法吗,谢谢
 
To guosoong:
你说的是备注型字段还是字段的备注?得了,一起给你写出来好了。当然,如你所愿,创建数据库、表、字段不用 SQL 语句,就用 ADOX。
uses ComObj;

const
adEmpty = $00000000; //空
adInteger = $00000003; //长整
adSingle = $00000004; //单精
adDouble = $00000005; //双精
adCurrency = $00000006; //货币
adVarWChar = $000000CA; //文本
adLongVarWChar = $000000CB; //备注

function CreateMDB(const DBName, TableName: string): Boolean;
var
cat, tbl, col: OleVariant;
begin
Result := True;
try
try
cat := CreateOleObject('ADOX.Catalog');
cat.Create('Provider=Microsoft.Jet.OLEDB.4.0;Data Source=' + DBName);

tbl := CreateOleObject('ADOX.Table');
tbl.ParentCatalog := cat;
tbl.Name := TableName;

//生成一个带备注的长整字段
col := CreateOleObject('ADOX.Column');
col.ParentCatalog := cat;
col.Name := '长整字段';
col.Type := adInteger;
col.DefinedSize := 4;
col.Properties['Description'].Value := '长整字段的说明';
tbl.Columns.Append(col, adEmpty, 0);
col := Unassigned;
//生成一个带备注的文本字段
col := CreateOleObject('ADOX.Column');
col.ParentCatalog := cat;
col.Name := '文本字段';
col.Type := adVarWChar;
col.DefinedSize := 50;
col.Properties['Description'].Value := '文本字段的说明';
tbl.Columns.Append(col, adEmpty, 0);
//生成一个不带备注的双精字段,比上面要简单的多
tbl.Columns.Append('双精字段', adDouble, 8);
//这个就是你要的备注字段
tbl.Columns.Append('备注字段', adLongVarWChar, 16);

cat.Tables.Append(tbl);
except
Result := False;
end;
finally
cat := Unassigned;
tbl := Unassigned;
col := Unassigned;
end;
end;
 
谢谢,vvyang,非常感谢
 
好贴!
“他山之石,可以攻玉”,果然不假,谢谢!!!
 
to vvyang
再次向你请教,delphi的IDE界面,对这些Com代码好像都没有及时提示(至少我机器上的delphi7是这样),我想问一下,你是怎么解决这个问题的,还有像那些常数值应该在什么地方可以找到,谢谢!因为,我很想知道,建立access数据库时的自动编号的属性,该是什么值。
 
1、不是记录形式(包括什么狗屁类)哪来的提示,我解决的办法就是查 ADO 的帮助,你装了 Office 就有;
2、至于那些常数值不是在帖子里写了么,在 ADODB2000.pas 里,或者搜索 adovbs.inc,你写过 Asp 应该知道有这么个东西;
3、自动编号实际上也是整数类型,就多了 Properties['Autoincrement'].Value := True 这么一句话。
//生成一个带备注的自动编号字段
col := CreateOleObject('ADOX.Column');
col.ParentCatalog := cat;
col.Name := '自动编号字段';
col.Type := adInteger;
col.DefinedSize := 4;
col.Properties['Autoincrement'].Value := True;
col.Properties['Description'].Value := '自动编号字段的说明';
tbl.Columns.Append(col, adEmpty, 0);
col := Unassigned;
 
听君一席话,胜读十年书!非常感谢!vvyang
 


---------------------------------------

              欢迎访问 http://www.coderpub.com 技术论坛
 
好!学习学习。。。
 
vvyang兄,我根据你提供的知识,编写了下面几个函数

红色的字体,就是我略有疑问的地方。
我的动机:当一个数据库已经建立好之后,只能在同一个库中新建不同的表,无法使用语句
DB := CreateOleObject('ADOX.Catalog');

那我使用语句
DBEngine := CreateOleObject('DAO.DBEngine.36');
DB := DBEngine.OpenDatabase(DBName);
来打开数据库并建立新表是否可行。耽误你的时间了,谢谢

unit DatabaseUnit;

interface
uses Windows, Messages, SysUtils, Variants, Classes,comobj,DB,ADODB,Controls;

//Access数据库中的表结构
type
TAccessTableDef = record
Name,
DateCreated,
LastUpdated,
Description: string;
end;
pTaccessTableDef = ^TAccessTableDef;

//Access数据库中的字段结构
type
TAccessFieldDef = record
Name: string;
Types,
Size: Longint;
Autoincrement: string;
Description: string;
end;
pTAccessFieldDef = ^TAccessFieldDef;

const
accessstring = 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%s';
adEmpty = $00000000; //空
adInteger = $00000003; //长整
adSingle = $00000004; //单精
adDouble = $00000005; //双精
adCurrency = $00000006; //货币
adVarWChar = $000000CA; //文本
adLongVarWChar = $000000CB; //备注


procedure CreateDatabase(DBName: string); //建立Access数据库
Procedure _CreateDatabaseTable(DBName: string; Tablenames:Tstrings; FieldDefsListArray: array of Tlist; arraycount: integer); //建立Access数据库中的表
procedure GetTableDefs(const DBName: string; TableDefsList: Tlist); //获得Access数据库中的表信息
procedure GetFieldDefs(const DBName, TableName: string; FieldDefsList: Tlist); //获得Access数据库中的每个表中的字段信息
procedure RenameField(const TableName, OldColName, NewColName: string; ADOConnection:TADOConnection ); //动态修改Access数据库字段内容
function CheckTablename(Const DBName, TableName: string): boolean;
implementation

procedure CreateDatabase(DBName: string); //建立access数据库
var
DB: OleVariant;
tempstr: string;
begin
DB := CreateOleObject('ADOX.Catalog');
try
tempstr := format(accessstring,[DBName]);
DB.Create(tempstr);
finally
DB:=Unassigned;
end;
end;

Procedure _CreateDatabaseTable(DBName: string; Tablenames:Tstrings; FieldDefsListArray: array of Tlist; arraycount: integer); //建立Access数据库中的表
var
DBEngine, DB,tables,Cols: OleVariant;
temploop1,temploop2: integer;
temppointer: pTAccessFieldDef;
begin
if not FileExists(DBName) then //如果没有发现数据库就建立数据库
CreateDatabase(DBName);
if TableNames.Count <= 0 then exit;
if TableNames.Count <> arraycount then exit; //名称和字段信息个数不一致,就退出

[red]DBEngine := CreateOleObject('DAO.DBEngine.36');
DB := DBEngine.OpenDatabase(DBName);[/red] try
for temploop1 := 0 to TableNames.Count -1 do
begin
if CheckTablename(DBName,TableNames[temploop1]) then //如果没有同名就建立
begin
tables := CreateOleObject('ADOX.Table');
tables.ParentCatalog := DBEngine;
tables.name := TableNames[temploop1]; //表建立好之后,就开始建立字段
if FieldDefsListArray[temploop1].Count > 0 then
begin
for temploop2 := 0 to FieldDefsListArray[temploop1].Count -1 do
begin
temppointer := FieldDefsListArray[temploop1].Items[temploop2];
Cols := CreateOleObject('ADOX.Column');
Cols.ParentCatalog := DBEngine;
case temppointer.Types of
adInteger: begin
Cols.Name := temppointer.Name;
Cols.type := temppointer.Types;
Cols.DefinedSize := temppointer.Size;
Cols.Properties['Autoincrement'].Value := strtobool(temppointer.Autoincrement);
Cols.Properties['Description'].Value := temppointer.Description;
tables.Columns.Append(Cols, adEmpty, 0);
Cols := Unassigned;
end;
adVarWChar: begin
Cols.Name := temppointer.Name;
Cols.type := temppointer.Types;
Cols.DefinedSize := temppointer.Size;
Cols.Properties['Description'].Value := temppointer.Description;
tables.Columns.Append(Cols, adEmpty, 0);
Cols := Unassigned;
end;
adLongVarWChar: begin
Cols.Name := temppointer.Name;
Cols.type := temppointer.Types;
Cols.DefinedSize := temppointer.Size;
Cols.Properties['Description'].Value := temppointer.Description;
tables.Columns.Append(Cols, adEmpty, 0);
Cols := Unassigned;
end;
end; //case temppointer.Types of

end; //for temploop2 := 0 to FieldDefsListArray[temploop1].Count -1 do

tables:= Unassigned; //每个表的所有字段都建立好之后,就注销,进入下一个表
Cols:= Unassigned;
end
else //if FieldDefsListArray[temploop1].Count > 0 then 如果字段小于等于0 就不要建立这个表的字段,
begin //进入下一张表
tables:= Unassigned;
Cols:= Unassigned;
end;


end //if CheckTablename(DBName,TableNames[temploop1]) then //如果没有同名就建立
end; //for temploop1 := 0 to TableNames.Count -1 do
finally
DBEngine:= Unassigned;
DB:= Unassigned;
tables:= Unassigned;
Cols:= Unassigned;
end;

end;


procedure GetTableDefs(const DBName: string; TableDefsList: Tlist); //获得Access数据库中的表信息
var
DBEngine, DB: OleVariant;
I: Longint;
temppointer: pTaccessTableDef;
begin
try
DBEngine := CreateOleObject('DAO.DBEngine.36');
DB := DBEngine.OpenDatabase(DBName);
if Longint(DB.TableDefs.Count) > 0 then
begin
for I := 0 to Longint(DB.TableDefs.Count)-1 do
begin
new(temppointer);
temppointer.Name := DB.TableDefs.Name;
temppointer.DateCreated := DB.TableDefs.DateCreated;
temppointer.LastUpdated := DB.TableDefs.LastUpdated;
try
temppointer.Description := DB.TableDefs.Properties['Description'].Value;
except
temppointer.Description := '';
end;
TableDefsList.Add(temppointer);
end; //for I := 0 to Longint(DB.TableDefs.Count)-1 do
end; // if Longint(DB.TableDefs.Count) > 0 then
finally
DB := Unassigned;
DBEngine := Unassigned;
end;
end;


procedure GetFieldDefs(const DBName, TableName: string; FieldDefsList: Tlist); //获得Access数据库中的每个表中的字段信息
var
DBEngine, DB: OleVariant;
I: Longint;
temppointer: pTAccessFieldDef;
begin
try
DBEngine := CreateOleObject('DAO.DBEngine.36');
DB := DBEngine.OpenDatabase(DBName);
if Longint(DB.TableDefs[TableName].Fields.Count) > 0 then
begin
for I := 0 to Longint(DB.TableDefs[TableName].Fields.Count) -1 do
begin
new(temppointer);
temppointer.Name := DB.TableDefs[TableName].Fields.Name;
temppointer.Types := DB.TableDefs[TableName].Fields.Type;
temppointer.Size := DB.TableDefs[TableName].Fields.Size;
try
temppointer.Description := DB.TableDefs[TableName].Fields.Properties['Description'].Value;
except
temppointer.Description := '';
end;
FieldDefsList.Add(temppointer);
end; //Longint(DB.TableDefs[TableName].Fields.Count) > 0
end; // Longint(DB.TableDefs[TableName].Fields.Count) > 0
finally
DB := Unassigned;
DBEngine := Unassigned;
end;
end;


//TableName: 表名; OldColName: 原字段名; NewColName: 新字段名;
procedure RenameField(const TableName, OldColName, NewColName: string; ADOConnection:TADOConnection );
var
DB, Col: OleVariant;
begin
try
DB := CreateOleObject('ADOX.Catalog');
DB.ActiveConnection := ADOConnection.ConnectionObject;
Col := CreateOleObject('ADOX.Column');
Col := DB.Tables[TableName].Columns[OldColName];
Col.Name := NewColName;
finally
DB := Unassigned;
Col := Unassigned;
end;
end;


function CheckTablename(Const DBName, TableName: string): boolean; //true 表示没有检测到相同表名,就可以建立,
var //false 表示检测到相同表名,不可以建立
tableNamelist: Tlist;
temploop: integer;
temppointer: pTaccessTableDef;
begin
result := false;
if not FileExists(DBName) then
CreateDatabase(DBName);

tableNamelist := Tlist.Create;
try
GetTableDefs(DBName,tableNameList);
if tableNamelist.Count > 0 then
begin
for temploop := 0 to TableNameList.Count -1 do
begin
temppointer := TableNamelist.Items[temploop];
if UpperCase(tableName) = UpperCase(temppointer.Name) then
exit;
end;
end;
result := true; //如果里面没有表也可以返回true
finally
tableNamelist.Clear;
tablenamelist.Free;
end;
end;

end.
 
我不太明白你的意思,说清楚先。
 
我的意思是,当一个Access数据库建立好之后(但里面没有表),如何再次打开这个数据库。用DB := CreateOleObject('ADOX.Catalog');
会出错,因为这个.MDB文件已经存在。
是否用可以用
DBEngine := CreateOleObject('DAO.DBEngine.36');
DB := DBEngine.OpenDatabase(DBName);
劳您费心了,谢谢

具体代码如下
Procedure _CreateDatabaseTable(DBName: string; Tablenames:Tstrings; FieldDefsListArray: array of Tlist; arraycount: integer); //建立Access数据库中的表
var
DBEngine, DB,tables,Cols: OleVariant;
temploop1,temploop2: integer;
temppointer: pTAccessFieldDef;
begin
if not FileExists(DBName) then //如果没有发现数据库就建立数据库
CreateDatabase(DBName);
if TableNames.Count <= 0 then exit;
if TableNames.Count <> arraycount then exit; //名称和字段信息个数不一致,就退出

DBEngine := CreateOleObject('DAO.DBEngine.36'); //就是这里,当一个MDB文件已经存在是否,用这个方法打开
DB := DBEngine.OpenDatabase(DBName);

try
for temploop1 := 0 to TableNames.Count -1 do
begin
if CheckTablename(DBName,TableNames[temploop1]) then //如果没有同名就建立
begin
tables := CreateOleObject('ADOX.Table');
tables.ParentCatalog := DBEngine;
tables.name := TableNames[temploop1]; //表建立好之后,就开始建立字段
if FieldDefsListArray[temploop1].Count > 0 then
begin
for temploop2 := 0 to FieldDefsListArray[temploop1].Count -1 do
begin
temppointer := FieldDefsListArray[temploop1].Items[temploop2];
Cols := CreateOleObject('ADOX.Column');
Cols.ParentCatalog := DBEngine;
case temppointer.Types of
adInteger: begin
Cols.Name := temppointer.Name;
Cols.type := temppointer.Types;
Cols.DefinedSize := temppointer.Size;
Cols.Properties['Autoincrement'].Value := strtobool(temppointer.Autoincrement);
Cols.Properties['Description'].Value := temppointer.Description;
tables.Columns.Append(Cols, adEmpty, 0);
Cols := Unassigned;
end;
adVarWChar: begin
Cols.Name := temppointer.Name;
Cols.type := temppointer.Types;
Cols.DefinedSize := temppointer.Size;
Cols.Properties['Description'].Value := temppointer.Description;
tables.Columns.Append(Cols, adEmpty, 0);
Cols := Unassigned;
end;
adLongVarWChar: begin
Cols.Name := temppointer.Name;
Cols.type := temppointer.Types;
Cols.DefinedSize := temppointer.Size;
Cols.Properties['Description'].Value := temppointer.Description;
tables.Columns.Append(Cols, adEmpty, 0);
Cols := Unassigned;
end;
end; //case temppointer.Types of

end; //for temploop2 := 0 to FieldDefsListArray[temploop1].Count -1 do

tables:= Unassigned; //每个表的所有字段都建立好之后,就注销,进入下一个表
Cols:= Unassigned;
end
else //if FieldDefsListArray[temploop1].Count > 0 then 如果字段小于等于0 就不要建立这个表的字段,
begin //进入下一张表
tables:= Unassigned;
Cols:= Unassigned;
end;


end //if CheckTablename(DBName,TableNames[temploop1]) then //如果没有同名就建立
end; //for temploop1 := 0 to TableNames.Count -1 do
finally
DBEngine:= Unassigned;
DB:= Unassigned;
tables:= Unassigned;
Cols:= Unassigned;
end;

end;
 
我終于搞定了,vvyang謝謝啦
獻上整個單元供大家指導我,小的在這裡抛磚引玉了。

鬱悶了好久,終于搞定了。哈哈
獻上整個函數單元供大家參考;


unit DatabaseUnit;

interface
uses Windows, Messages, SysUtils, Variants, Classes,comobj,DB,ADODB,Controls;






procedure CreateDatabase(DBName: string); //建立Access数据库
Procedure _CreateDatabaseTable(DBName: string; Tablenames:Tstrings; FieldDefsListArray: array of Tlist; arraycount: integer); //建立Access数据库中的表
procedure GetTableDefs(const DBName: string; TableDefsList: Tlist); //获得Access数据库中的表信息
procedure GetFieldDefs(const DBName, TableName: string; FieldDefsList: Tlist); //获得Access数据库中的每个表中的字段信息
procedure RenameField(const TableName, OldColName, NewColName: string; ADOConnection:TADOConnection ); //动态修改Access数据库字段内容
function CheckTablename(Const DBName, TableName: string): boolean;
implementation

uses VariableUnit;

procedure CreateDatabase(DBName: string); //建立access数据库
var
DB: OleVariant;
tempstr: string;
begin
DB := CreateOleObject('ADOX.Catalog');
try
tempstr := format(accessstring,[DBName]);
DB.Create(tempstr);
finally
DB:=Unassigned;
end;
end;

Procedure _CreateDatabaseTable(DBName: string; Tablenames:Tstrings; FieldDefsListArray: array of Tlist; arraycount: integer); //建立Access数据库中的表
var
DB,tables,Cols: OleVariant; //DBEngine,
temploop1,temploop2: integer;
temppointer: pTAccessFieldDef;
tempADOConnection:TADOConnection;
tempstr: string;
begin
if not FileExists(DBName) then //如果没有发现数据库就建立数据库
CreateDatabase(DBName);
if TableNames.Count <= 0 then exit;
if TableNames.Count <> arraycount then exit; //名称和字段信息个数不一致,就退出

// DBEngine := CreateOleObject('DAO.DBEngine.36');
//DB := DBEngine.OpenDatabase(DBName);

DB := CreateOleObject('ADOX.Catalog');
tempADOConnection := TADOConnection.Create(nil);
tempstr := format(accessstring,[DBName]);
tempADOConnection.ConnectionString := tempstr;
tempADOConnection.Open;
DB.ActiveConnection := tempADOConnection.ConnectionObject;

try
for temploop1 := 0 to TableNames.Count -1 do
begin
if CheckTablename(DBName,TableNames[temploop1]) then //如果没有同名就建立
begin
tables := CreateOleObject('ADOX.Table');

tables.ParentCatalog := DB;
tables.name := TableNames[temploop1]; //表建立好之后,就开始建立字段
if FieldDefsListArray[temploop1].Count > 0 then
begin
for temploop2 := 0 to FieldDefsListArray[temploop1].Count -1 do
begin
temppointer := FieldDefsListArray[temploop1].Items[temploop2];
Cols := CreateOleObject('ADOX.Column');
Cols.ParentCatalog := DB;
case temppointer.Types of
adInteger: begin
Cols.Name := temppointer.Name;
Cols.type := temppointer.Types;
Cols.DefinedSize := temppointer.Size;
Cols.Properties['Autoincrement'].Value := strtobool(temppointer.Autoincrement);
Cols.Properties['Description'].Value := temppointer.Description;
tables.Columns.Append(Cols, adEmpty, 0);
Cols := Unassigned;
end;
adVarWChar: begin
Cols.Name := temppointer.Name;
Cols.type := temppointer.Types;
Cols.DefinedSize := temppointer.Size;
Cols.Properties['Description'].Value := temppointer.Description;
tables.Columns.Append(Cols, adEmpty, 0);
Cols := Unassigned;
end;
adLongVarWChar: begin
Cols.Name := temppointer.Name;
Cols.type := temppointer.Types;
Cols.DefinedSize := temppointer.Size;
Cols.Properties['Description'].Value := temppointer.Description;
tables.Columns.Append(Cols, adEmpty, 0);
Cols := Unassigned;
end;
end; //case temppointer.Types of

end; //for temploop2 := 0 to FieldDefsListArray[temploop1].Count -1 do

DB.Tables.Append(tables);
tables:= Unassigned; //每个表的所有字段都建立好之后,就注销,进入下一个表
Cols:= Unassigned;
end
else //if FieldDefsListArray[temploop1].Count > 0 then 如果字段小于等于0 就不要建立这个表的字段,
begin //进入下一张表
tables:= Unassigned;
Cols:= Unassigned;
end;


end //if CheckTablename(DBName,TableNames[temploop1]) then //如果没有同名就建立
end; //for temploop1 := 0 to TableNames.Count -1 do
finally
//DBEngine:= Unassigned;
tempADOConnection.Close;
DB:= Unassigned;
tables:= Unassigned;
Cols:= Unassigned;
tempADOConnection.Free;
end;

end;


procedure GetTableDefs(const DBName: string; TableDefsList: Tlist); //获得Access数据库中的表信息
var
DBEngine, DB: OleVariant;
I: Longint;
temppointer: pTaccessTableDef;
begin
try
DBEngine := CreateOleObject('DAO.DBEngine.36');
DB := DBEngine.OpenDatabase(DBName);
if Longint(DB.TableDefs.Count) > 0 then
begin
for I := 0 to Longint(DB.TableDefs.Count)-1 do
begin
new(temppointer);
temppointer.Name := DB.TableDefs.Name;
temppointer.DateCreated := DB.TableDefs.DateCreated;
temppointer.LastUpdated := DB.TableDefs.LastUpdated;
try
temppointer.Description := DB.TableDefs.Properties['Description'].Value;
except
temppointer.Description := '';
end;
TableDefsList.Add(temppointer);
end; //for I := 0 to Longint(DB.TableDefs.Count)-1 do
end; // if Longint(DB.TableDefs.Count) > 0 then
finally
DB := Unassigned;
DBEngine := Unassigned;
end;
end;


procedure GetFieldDefs(const DBName, TableName: string; FieldDefsList: Tlist); //获得Access数据库中的每个表中的字段信息
var
DBEngine, DB: OleVariant;
I: Longint;
temppointer: pTAccessFieldDef;
begin
try
DBEngine := CreateOleObject('DAO.DBEngine.36');
DB := DBEngine.OpenDatabase(DBName);
if Longint(DB.TableDefs[TableName].Fields.Count) > 0 then
begin
for I := 0 to Longint(DB.TableDefs[TableName].Fields.Count) -1 do
begin
new(temppointer);
temppointer.Name := DB.TableDefs[TableName].Fields.Name;
temppointer.Types := DB.TableDefs[TableName].Fields.Type;
temppointer.Size := DB.TableDefs[TableName].Fields.Size;
try
temppointer.Description := DB.TableDefs[TableName].Fields.Properties['Description'].Value;
except
temppointer.Description := '';
end;
FieldDefsList.Add(temppointer);
end; //Longint(DB.TableDefs[TableName].Fields.Count) > 0
end; // Longint(DB.TableDefs[TableName].Fields.Count) > 0
finally
DB := Unassigned;
DBEngine := Unassigned;
end;
end;


//TableName: 表名; OldColName: 原字段名; NewColName: 新字段名;
procedure RenameField(const TableName, OldColName, NewColName: string; ADOConnection:TADOConnection );
var
DB, Col: OleVariant;
begin
try
DB := CreateOleObject('ADOX.Catalog');
DB.ActiveConnection := ADOConnection.ConnectionObject;
Col := CreateOleObject('ADOX.Column');
Col := DB.Tables[TableName].Columns[OldColName];
Col.Name := NewColName;
finally
DB := Unassigned;
Col := Unassigned;
end;
end;


function CheckTablename(Const DBName, TableName: string): boolean; //true 表示没有检测到相同表名,就可以建立,
var //false 表示检测到相同表名,不可以建立
tableNamelist: Tlist;
temploop: integer;
temppointer: pTaccessTableDef;
begin
result := false;
if not FileExists(DBName) then
CreateDatabase(DBName);

tableNamelist := Tlist.Create;
try
GetTableDefs(DBName,tableNameList);
if tableNamelist.Count > 0 then
begin
for temploop := 0 to TableNameList.Count -1 do
begin
temppointer := TableNamelist.Items[temploop];
if UpperCase(tableName) = UpperCase(temppointer.Name) then
exit;
end;
end;
result := true; //如果里面没有表也可以返回true
finally
tableNamelist.Clear;
tablenamelist.Free;
end;
end;

end.
 
樓主 => 強.
 
你这还叫班门弄斧,那谁还敢卖斧啊。厉害。。收藏先。。。。。
 
既然是针对Access数据库,为什么不使用DAO?只是说说而已
 
楼主,你真是太厉害了,我羡慕死你了!
向你学习!
 
后退
顶部