Forum Discussion
tristaanogre
14 years agoEsteemed Contributor
Simon,
What scripting language are you using? The reason I ask is that, with either DelphiScript or the JScript derivatives (JScript, C++Script, C#Script), you can use a try/catch/finally logic in your routines utilizing your DDT drivers. This was a best practice I implemented in a previous life in that the finally block of each routine that created a DDT driver had corresponding code to close it. There's not a nice clean way to get a listing of ALL the DDT driver objects currently open in a test project so you need to make sure that you close the drivers in code. The finally block is the best way I've found to do so because it guarentees that, even if there is an error, the DDT driver will close.
Now, beyond that, I needed to write other code to detect if the DDT driver had actually been created because if you try calling DDT.CloseDriver on a driver that doesn't exist, you get an error. so, I created this:
What scripting language are you using? The reason I ask is that, with either DelphiScript or the JScript derivatives (JScript, C++Script, C#Script), you can use a try/catch/finally logic in your routines utilizing your DDT drivers. This was a best practice I implemented in a previous life in that the finally block of each routine that created a DDT driver had corresponding code to close it. There's not a nice clean way to get a listing of ALL the DDT driver objects currently open in a test project so you need to make sure that you close the drivers in code. The finally block is the best way I've found to do so because it guarentees that, even if there is an error, the DDT driver will close.
Now, beyond that, I needed to write other code to detect if the DDT driver had actually been created because if you try calling DDT.CloseDriver on a driver that doesn't exist, you get an error. so, I created this:
function CloseDriver(DriverName)
{
if (IsSupported(DDT.DriverByName(DriverName), "ADOCommandObject"))
{
if (DDT.DriverByName(DriverName).ADOCommandObject != EmptyVariant)
{
DDT.CloseDriver(DriverName);
}
}
}
Related Content
Recent Discussions
- 6 days ago
- 6 days ago
- 9 days ago