What am I doing wrong. I need to open my Excel spreadsheet connection numerous times through my tests. (I.e more than 64!) I would have expected that if I opened a connection by using :
Set XLnameSheet = DDT.ExcelDriver (nameXLFullPath, Work-SheetName)
then I could close this driver connection by calling:
Call DDT.CloseDriver (NameXLFullPath)
I am using VB script with Vista.
I know if doesn't work because when I open then close the driver connections 100 times it always fails on the 64th one with an error:
An exception occured in the "Test" unit at line "X":
I would have expected the connection to open and close as many times as you like it to.
1) Am I wrong in thinking this is how it works?
2) How can I open a connection and then close it again, and then reopen it and reclose it etc....
I am fairly new to Test Complete so if you can help me, please can you explain it to me like I'm an infant!
Re: DDT.CloseDriver does not work as I would expect!
First of all, please reference responses to your other post on the same topic. Essentially, you need to make sure that you are passing the NAME to the CloseDriver method, not the path to the Excel file. (see responses posted to http://www.sqaforums.com/showthreade...516&page=)
Secondly, please note that, without properly closing a connection, the DDT drivers using the microsoft Jet data engine can only open a maximum of 65 connections (0 through 64). Again, this was posted and replied to at http://www.sqaforums.com/showflat.ph...=0&gonew=1
My suggestion would be that, rather than opening up 100 connections to the same data sheet, if you need to access it that many times, you should make some sort of global variable or object that you can call and reference throughout your script.
I believe the the DDT object implementation of the Jet engine opens a forward only connection to the record set. If you need to navigate around the record set, querying multiple records out of order, I would suggest creating your own ADODB.Recordset object using your Excel spreadsheet. It is possible, using the MS ADODB objects (using Sys.OleObject to instantiate), to create a record set that allows navigation through the recordset both forwards and backwards. You can also execute specific SQL queries and such while the DDT object is a record by record traverse through the records set.