universal enterprise data connectivity for the multi … tdatetime; totaldays: integer; i: integer;...
TRANSCRIPT
![Page 1: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/1.jpg)
![Page 2: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/2.jpg)
![Page 3: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/3.jpg)
![Page 4: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/4.jpg)
![Page 5: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/5.jpg)
![Page 6: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/6.jpg)
![Page 7: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/7.jpg)
![Page 8: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/8.jpg)
![Page 9: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/9.jpg)
C:\Users\Public\Documents\RAD Studio\12.0\Samples\Data
![Page 10: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/10.jpg)
![Page 11: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/11.jpg)
![Page 12: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/12.jpg)
![Page 13: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/13.jpg)
![Page 14: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/14.jpg)
![Page 15: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/15.jpg)
![Page 16: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/16.jpg)
procedure TDataModule2.DataModuleCreate(Sender: TObject);
var
DataDir: string;
begin
DataDir := 'C:\Users\Public\Documents\RAD Studio\' +
FloatToStr(CompilerVersion - 14) +
'.0\Samples\Data\';
FDConnection1.Params.Clear;
FDConnection1.Params.Add('Database=' + DataDir + 'dbdemos.db');
FDConnection1.Params.Add('User_Name=sysdba');
FDConnection1.Params.Add('DriverID=MSAcc');
FDQuery1.Open;
end;
![Page 17: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/17.jpg)
![Page 18: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/18.jpg)
![Page 19: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/19.jpg)
SELECT &FieldList FROM &TableName
procedure TForm1.LoadData;
var
i: Integer;
FieldList: string;
ListBoxItem: TListBoxItem;
procedure BuildList(Value: string);
begin
if FieldList = '' then
FieldList := Value
else
FieldList := FieldList + ', ' + Value;
end;
![Page 20: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/20.jpg)
begin
DataModule2.SelectQry.Close;
for i := 0 to ListBox2.Items.Count - 1 do
if ListBox2.ListItems[i].IsSelected then
BuildList(ListBox2.ListItems[i].Text);
DataModule2.SelectQry.Macros[0].AsRaw := FieldList;
DataModule2.SelectQry.Macros[1].AsRaw := ListBox1.Selected.Text;
DataModule2.SelectQry.Open;
end;
SELECT {Current_Date()} AS Today,
c.*
FROM &TabName c
WHERE {Extract(Year, c.SaleDate)} = {e 1988}
![Page 21: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/21.jpg)
![Page 22: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/22.jpg)
![Page 23: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/23.jpg)
procedure TForm1.SaveToFileBtnClick(Sender: TObject);
begin
FDQuery1.SaveToFile(ExtractFilePath(ParamStr(0)) +
'file.xml', TFDStorageFormat.sfXML);
end;
procedure TForm1.LoadFromFileBtnClick(Sender: TObject);
begin
if IOUtils.TFile.Exists(ExtractFilePath(ParamStr(0)) + 'file.xml') then
begin
//Disconnect the query from the DataSource
DataSource1.DataSet := nil;
FDQuery1.LoadFromFile(ExtractFilePath(ParamStr(0)) +
'file.xml', TFDStorageFormat.sfXML);
//Reconnect the DataSource.
DataSource1.DataSet := FDQuery1;
end;
end;
![Page 24: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/24.jpg)
procedure TForm1.Button1Click(Sender: TObject);
var
![Page 25: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/25.jpg)
CurrentDate: TDateTime;
TotalDays: Integer;
i: Integer;
begin
if DateTimePicker1.Date >= DateTimePicker2.Date then
raise Exception.Create('Starting date cannot following ending date');
TotalDays := DateUtils.DaysBetween(DateTimePicker1.Date,
DateTimePicker2.Date);
//Creating the table in a transaction that is committed
//before beginning the INSERT process ensures that the
//table is available when the Array DML process is initiated.
FDConnection1.StartTransaction;
try
FDConnection1.ExecSQL('CREATE TABLE ' + Edit1.Text + '( ' +
' DateValue date NOT NULL Primary Key, ' +
' DayName varchar(16) )');
finally
FDConnection1.Commit;
end;
FDQuery1.SQL.Text := 'INSERT INTO ' + Edit1.Text +
' (DateValue, DayName) VALUES(:Date, (:name) )';
CurrentDate := DateTimePicker1.Date;
//Set the array size
FDQuery1.Params.ArraySize := TotalDays;
//Insert the parameters
for i := 0 to TotalDays - 1 do
begin
FDQuery1.Params[0].AsDateTimes[i] := DateOf(CurrentDate);
FDQuery1.Params[1].AsStrings[i] := FormatDateTime('dddd', CurrentDate);
CurrentDate := IncDay(CurrentDate);
end;
//Execute the query
FDQuery1.Execute(FDQuery1.Params.ArraySize);
//Let's take a look at the data
FDQuery1.Open('SELECT * FROM ' + Edit1.Text);
DataSource1.DataSet := FDQuery1;
end;
![Page 26: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/26.jpg)
![Page 27: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/27.jpg)
![Page 28: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/28.jpg)
![Page 29: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/29.jpg)
![Page 30: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/30.jpg)
![Page 31: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/31.jpg)
https://forums.embarcadero.com/thread.jspa?messageID=600466&tstart=0
![Page 32: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/32.jpg)
SELECT e.FirstName || ' ' || e.LastName as Employee,
o.*
FROM Orders o
INNER JOIN Employees e ON e.EmpNo = o.EmpNo
![Page 33: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/33.jpg)
![Page 34: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/34.jpg)
![Page 35: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/35.jpg)
![Page 36: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/36.jpg)
![Page 37: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/37.jpg)
C:\Program Files (x86)\Embarcadero\RAD Studio\12.0\bin
C:\Users\Public\Documents\RAD Studio\xx.x\Samples\Delphi\Database\FireDAC\
Tool\reFind\AD2FDMigration
http://docwiki.embarcadero.com/RADStudio/XE5/en/
Migrating_AnyDAC_Applications_to_FireDAC
<RAD Studio>\Bin\reFind *.pas *.dpk *.dpr *.dproj *.inc /S /Y /I /W /B:0
/X:<RAD Studio Demos>\Delphi\Database\FireDAC\Tool\reFind\
AD2FDMigration\FireDAC_Rename_Units.txt
![Page 38: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/38.jpg)
"C:\Program Files (x86)\Embarcadero\RAD Studio\12.0\Bin\reFind"
*.pas *.dpk *.dpr *.dproj *.inc /S /Y /I /W /B:0
/X:"C:\Users\Public\Documents\RAD Studio\12.0\Samples\Delphi\Database\FireDAC
\Tool\reFind\AD2FDMigration\FireDAC_Rename_Units.txt"
"C:\Program Files (x86)\Embarcadero\RAD Studio\12.0\Bin\reFind" *.pas *.dfm
*.dpk *.dpr *.inc /S /Y /I /B:0 /X:"C:\Users\Public\Documents\RAD
Studio\12.0\Samples\Delphi\Database\FireDAC\Tool\reFind\AD2FDMigration\FireDA
C_Rename_API.txt"
http://docwiki.embarcadero.com/RADStudio/XE5/en/
ReFind.exe,_the_Search_and_Replace_Utility_Using_Perl_RegEx_Expressions
C:\Users\Public\Documents\RAD Studio\xx.x\Samples\Delphi\Database\
FireDAC\Tool\reFind
![Page 39: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/39.jpg)
![Page 40: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/40.jpg)
![Page 41: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/41.jpg)
![Page 42: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/42.jpg)
![Page 43: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/43.jpg)
![Page 44: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/44.jpg)
![Page 45: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/45.jpg)
Driver={Microsoft Paradox Driver (*.db )};DriverID=538;Fil=Paradox 5.X; DefaultDir=c:\pathToDb\;Dbq=c:\pathToDb\;CollatingSequence=ASCII;
DriverID=538;Fil=Paradox 5.X;DefaultDir=C:\Users\Public\Documents\RAD Studio\12.0\
Samples\Data\;Dbq=C:\Users\Public\Documents\RAD Studio\12.0\Samples\Data\;
CollatingSequence=ASCII;
![Page 46: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/46.jpg)
![Page 47: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/47.jpg)
procedure TDataModule1.DataModuleCreate(Sender: TObject);
var
DataDir: string;
![Page 48: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/48.jpg)
const
DataSourceName = 'PDX Sample Data';
begin
DataDir := 'C:\Users\Public\Documents\RAD Studio\' +
FloatToStr(CompilerVersion - 14) +
'.0\Samples\Data';
if not ParadoxDSNExists(DataSourceName) then
CreateParadoxDSN(DataSourceName, DataDir);
FDConnection1.Params.Clear;
FDConnection1.Params.Add('DataSource=' + DataSourceName);
FDConnection1.Params.Add('DriverID=ODBC');
FDQuery1.Open;
end;
unit ParadoxDSNx86;
interface
uses Winapi.Windows, System.SysUtils;
function ParadoxDSNExists(DataSourceName: string): Boolean;
procedure CreateParadoxDSN(DataSourceName: string; DataDirectory: string);
implementation
uses Registry;
const
ODBC_ADD_SYS_DSN = 4; // add a system DSN
function SQLConfigDataSource( hwndParent: LongWord ; fRequest: Word ;
lpszDriver: PChar ; lpszAttributes: pchar ): boolean;
stdcall; external 'ODBCCP32.DLL' name 'SQLConfigDataSourceW';
function ParadoxDSNExists(DataSourceName: string): Boolean;
var
Registry: TRegistry;
![Page 49: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/49.jpg)
begin
Registry := TRegistry.Create;
try
Registry.RootKey := HKEY_LOCAL_MACHINE;
Result := Registry.KeyExists('Software\Wow6432Node\ODBC\ODBC.INI\' +
DataSourceName);
finally
Registry.Free;
end;
end;
procedure CreateParadoxDSN(DataSourceName: string; DataDirectory: string);
var
Attributes: string;
RetVal: Boolean;
DriverName: PChar;
DirName: string;
begin
DriverName := 'Microsoft Paradox Driver (*.db )';
Attributes := 'DSN=' + DataSourceName + #0;
Attributes := Attributes + 'DefaultDir=' + DataDirectory + #0;
Attributes := Attributes + 'Dbq=' + DataDirectory + #0;
Attributes := Attributes + 'Fil=Paradox 5.0'#0;
Attributes := Attributes + 'DESCRIPTION=' + DataSourceName + #0#0;
RetVal := SqlConfigDataSource(0, ODBC_ADD_SYS_DSN, DriverName,
PChar(Attributes));
if not RetVal then
begin
Exception.Create('Failed to create data source name. Cannot continue');
end;
end;
end.
![Page 50: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/50.jpg)
FDPhysODBCDriverLink1.DriverID := 'Paradox';
FDPhysODBCDriverLink1.ODBCDriver := '{Microsoft Paradox Driver (*.db )}';
FDPhysODBCDriverLink1.ODBCAdvanced := 'DriverID=538;Fil=Paradox 5.X;' +
'CollatingSequence=ASCII;';
FDConnection1.Params.Add('DriverID=Paradox');
FDConnection1.Params.Add('Database= C:\Users\Public\Documents\' +
'RAD Studio\12.0\Samples\Data\');
FDConnection1.Connected := True;
![Page 51: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/51.jpg)
![Page 52: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/52.jpg)
procedure TDataModule1.DataModuleCreate(Sender: TObject);
var
DataDir: string;
begin
DataDir := 'C:\Users\Public\Documents\RAD Studio\' +
FloatToStr(CompilerVersion - 14) +
'.0\Samples\Data\';
FDConnection1.Params.Clear;
FDConnection1.Params.Add('Database=' + DataDir + 'dbdemos.gdb');
FDConnection1.Params.Add('User_Name=sysdba');
FDConnection1.Params.Add('DriverID=IB');
FDQuery1.SQL.Text := 'SELECT * FROM Customer';
FDQuery1.Open;
end;
![Page 53: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/53.jpg)
![Page 54: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/54.jpg)
![Page 55: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/55.jpg)
![Page 56: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/56.jpg)
![Page 57: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/57.jpg)
![Page 58: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/58.jpg)
![Page 59: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/59.jpg)
![Page 60: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/60.jpg)
![Page 61: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/61.jpg)
![Page 62: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/62.jpg)
![Page 63: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/63.jpg)
![Page 64: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/64.jpg)
![Page 65: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/65.jpg)
if CustomerQry.Fields[0].AsInteger = 0 then
begin
CustomerQry.Edit;
CustomerQry.Fields[0].AsInteger := 1;
CustomerQry.Post;
end;
![Page 66: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/66.jpg)
if CustomerQry.FieldByName('Status').AsInteger = 0 then
begin
CustomerQry.Edit;
CustomerQry.FieldByName('Status').AsInteger := 1;
CustomerQry.Post;
end;
![Page 67: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/67.jpg)
type
TForm1 = class(TForm)
CustomerQry: TFDQuery;
![Page 68: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/68.jpg)
CustomerQryStatus: TIntegerField;
CustomerQryAccountNumber: TStringField;
CustomerQryFirstName: TStringField;
CustomerQryLastName: TStringField;
CustomerQryAddress1: TStringField;
CustomerQryAddress2: TStringField;
CustomerQryCity: TStringField;
CustomerQryState_Province: TStringField;
CustomerQryCountry: TStringField;
CustomerQryPostalCode: TStringField;
CustomerQryDateOfBirth: TDateField;
CustomerQryCreditLimit: TIntegerField;
//...
if CustomerQryStatus.AsInteger = 0 then
begin
CustomerQry.Edit;
CustomerQryStatus.AsInteger := 1;
CustomerQry.Post;
end;
CustomerQry.SQL.Text :=
'SELECT * FROM CUSTOMER WHERE AccountNumber = :accountno;
CustomerQry.Params[0].AsString := 'N00281';
CustomerQry.Open;
![Page 69: Universal Enterprise Data Connectivity for the Multi … TDateTime; TotalDays: Integer; i: Integer; begin if DateTimePicker1.Date >= DateTimePicker2.Date then raise Exception.Create('Starting](https://reader031.vdocuments.us/reader031/viewer/2022013117/5ac14de27f8b9a433f8cb0e4/html5/thumbnails/69.jpg)
CustomerQry.SQL.Text :=
'SELECT * FROM CUSTOMER WHERE AccountNumber = :accountno;
CustomerQry.ParamByName('accountno').AsString := 'N00281';
CustomerQry.Open;
http://docwiki.embarcadero.com/RADStudio/XE5/en/Developing_Database_Applications