Ask a Question

DBTable

Krishna_Kumar
Contributor

DBTable

Hi team,

Can we read Excel data using adodb string (recordset) and update the same in project's DBTable in a single statement.

If that is possible can anyone guide me with the solution. Or esle why can't team add this as a feature in the upcoming update ?

 

Kind regards,

Sathish Kumar k

2 REPLIES 2
tristaanogre
Esteemed Contributor

Question:

 

Why would you need to read the excel sheet into a DBTable variable?  TestComplete can work with the excel sheet directly in a variety of ways.

 

The short answer to your question is.... not in a single code statement, no.  However, the DBTable variable can be configured to point to a variety of data sources.  Have you tried selecting Excel directly when setting up your DBTable?

2019-07-01 12_49_50-Clipboard.png


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

Like @tristaanogre said, you might want to think about why you are trying to do this as you have access to the data already in the Excel sheet from TestComplete

 

If we are mising something, then the answer is YES, you can do that, if you need to anyway.

Use the ADO object to create a connection, passing the connection string to your Excel OleDB Provider, then execute the query on the ADO object with the connection to get a dataset back from the excel sheet.

From that you can iterate through the dataset to find out how many rows and columns you have.

With a double for loop to go columns wide and rows high, you can create the DBTable programtically and assign the value for each cell during the iteration of the 2 for loops.

 

Hope that helps

-Lino

cancel
Showing results for 
Search instead for 
Did you mean: