phpbb3
26-07-2009, 06:13 AM
برنامج صغير ويمتلك كود بسيط يقوم بانشاء قاعده بيانات Paradox
وانشاء جدولين
واحد عن طريق الكود والاخر عن طريق Query
begin
Path:=ExtractFilePath(Application.ExeName)+'Data';
if not DirectoryExists(path) <> False then
begin
CreateDir(path) ;
with Table_Customer do begin
DatabaseName:=Path;
TableName:='Customer';
Active := False;
TableType := ttParadox;
with FieldDefs do begin
Clear;
with AddFieldDef do begin
Name := 'CID';
DataType := ftAutoInc;
Required := true;
end;
with AddFieldDef do begin
Name := 'CName';
DataType := ftString;
Size:=100;
Required := false;
end;
with AddFieldDef do begin
Name := 'CPhon';
DataType := ftString;
Size:=100;
Required := false;
end;
end;
//Session.AddPassword('phpbb3');
CreateTable;
end;
QuyApp.DatabaseName :=Path;
QuyApp.SQL.Clear;
QuyApp.SQL.Add('CREATE TABLE USERS (UName VARCHAR(50),UPass VARCHAR(50));');
QuyApp.ExecSQL;
end;
Table_Customer.DatabaseName:=Path;
Table_Customer.TableName:='Customer';
Table_Customer.Active:=True;
Table_User.DatabaseName:=Path;
Table_User.TableName:='USERS';
Table_User.Active:=True;
end;
اتمنى ان يكون مفيدا
وانشاء جدولين
واحد عن طريق الكود والاخر عن طريق Query
begin
Path:=ExtractFilePath(Application.ExeName)+'Data';
if not DirectoryExists(path) <> False then
begin
CreateDir(path) ;
with Table_Customer do begin
DatabaseName:=Path;
TableName:='Customer';
Active := False;
TableType := ttParadox;
with FieldDefs do begin
Clear;
with AddFieldDef do begin
Name := 'CID';
DataType := ftAutoInc;
Required := true;
end;
with AddFieldDef do begin
Name := 'CName';
DataType := ftString;
Size:=100;
Required := false;
end;
with AddFieldDef do begin
Name := 'CPhon';
DataType := ftString;
Size:=100;
Required := false;
end;
end;
//Session.AddPassword('phpbb3');
CreateTable;
end;
QuyApp.DatabaseName :=Path;
QuyApp.SQL.Clear;
QuyApp.SQL.Add('CREATE TABLE USERS (UName VARCHAR(50),UPass VARCHAR(50));');
QuyApp.ExecSQL;
end;
Table_Customer.DatabaseName:=Path;
Table_Customer.TableName:='Customer';
Table_Customer.Active:=True;
Table_User.DatabaseName:=Path;
Table_User.TableName:='USERS';
Table_User.Active:=True;
end;
اتمنى ان يكون مفيدا