This is a migrated thread and some comments may be shown as answers.

how to execute multiple query in single database connection ?

1 Answer 96 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Brindha
Top achievements
Rank 1
Brindha asked on 18 Dec 2012, 07:20 PM

I have created a test for the following

a. Add a name
b. Send an email

I need to verify the values against the database.  I have written two queries one for getting the name and other for getting the email id from the database.  In Coded step i have given the connection string and executed one query (retrieving a name).  To get the email id (retrieving an email) do i need to declare connection string again or add another coded step?  Both tables are in the same database.

1 Answer, 1 is accepted

Sort by
0
Nikolai
Telerik team
answered on 24 Dec 2012, 06:43 AM
Hi Brindha,

Your question doesn't seem to be related directly to TestStudio. Since you write your own code it is up to you to determine the scope and the life cycle of the objects you create. In general it is better to open a SQL connection execute the read/write operations you require and then close the connection so I guess in your case one connection object for two queries should be enough.

 

Kind regards,
Nikolai
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Tags
General Discussions
Asked by
Brindha
Top achievements
Rank 1
Answers by
Nikolai
Telerik team
Share this question
or