Forum Discussion
tristaanogre
15 years agoEsteemed Contributor
When you get your DBTables object, you can set the connection string dynamically in the scripts. We're doing something similar in that we can run the same project on multiple environments where the SQLServer name changes (not necessarily the table name). Here's our routine that does the compare.
procedure CompareWebTables;
var
I: Integer;
TableConnectionString: String;
RecordSet;
DBTableObj;
begin
RecordSet := DDT.CSVDriver(ScriptDirectory + '\Script\WebTableNames.csv');
TableConnectionString := ConnectionString + LocalDBName + 'Data Source = ' + ServerName + '; LoginPrompt := False;';
Log.AppendFolder('SQL Web File Comparisons:');
try
while not RecordSet.EOF do begin
Log.AppendFolder(RecordSet.Value['TableName']);
DBTableObj := Evaluate('DBTables.' + RecordSet.Value['TableName']);
DBTableObj.ConnectionString := TableConnectionString;
DBTableObj.Compare;
Log.PopLogFolder;
RecordSet.Next;
end;
finally
Log.PopLogFolder;
Indicator.Clear;
if IsAssigned(RecordSet) then DDT.CloseDriver(RecordSet.Name);
if ExceptionMessage <> ''
then ProcessError('The following error occured while comparing Web files: ' + ExceptionMessage, TRUE);
end;
end;
Related Content
- 10 years ago
- 4 years ago