how to execute multiple query in single database connection ?

2 posts, 0 answers
  1. Brindha
    Brindha avatar
    2 posts
    Member since:
    Oct 2012

    Posted 18 Dec 2012 Link to this post

    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.
  2. Nikolai
    Nikolai avatar
    112 posts

    Posted 24 Dec 2012 Link to this post

    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,
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
Back to Top