cancel
Showing results for 
Search instead for 
Did you mean: 

Database connection

SOLVED
Highlighted
New Contributor

Database connection

Hey guys,

 

I like to centralize the database connection string to switch fastly between 2 databases.

Does anybody knows how to do this?

 

I could imagine a solution like creating a string variable containing the connection string at the project suite level in testcomplete and using this variable value to create a dbtable variable at the test items level.

 

Is this possible in testcomplete?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
New Contributor

Re: Database connection

You can use a function that returns differents ConnectionString with a CASE/OF.

 

function YourFunction(WichConnection: string): OLEVariant;

begin

 case WichConnection of:

    'A': result := ConnectionStringA;

    'B': result := ConnectionStringB;

 end;

end;

View solution in original post

2 REPLIES 2
Highlighted
New Contributor

Re: Database connection

You can use a function that returns differents ConnectionString with a CASE/OF.

 

function YourFunction(WichConnection: string): OLEVariant;

begin

 case WichConnection of:

    'A': result := ConnectionStringA;

    'B': result := ConnectionStringB;

 end;

end;

View solution in original post

Highlighted
Community Manager

Re: Database connection

Thank you for advice @RuanAlesi !

 

@PUM-Prodat-SQL Was this what you are looking for?


Sonya Mihaljova
Community and Education Specialist

Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today
New Here?
Join us and watch the welcome video:
Announcements
Join TechCorner Challenge!
Want a fun and easy way to learn TestComplete? Try solving weekly TechCorner challenges and get into the Leaderboard!

Challenge Status

How to execute remote test and obtain results via Test Runner REST API

Participate!

Comparing content of HTML table with Excel file data

Participate!

Compare HTML table with Excel file and correct data in the file

Participate!

Retrieve Data from a Web Page

Participate!
Top Kudoed Authors