Forum Discussion

WillClarke's avatar
WillClarke
Occasional Contributor
7 years ago
Solved

Is there a way to update a single record in SQL by based on passing in a variable from the test case

For example, before my test, I need to disable an account so that I can test to make sure I cannot login with that username / password. I would need to run SQL like the below.

 

update useraccounts set accountlocked = 1 where username = 'usernamevar'

 

My google-fu and general searching did not find anything really applicable and could use some assistance. Thanks

  • SQL Queries can be run using the ADO objects built in to TestComplete specifically the CreateADOQuery method.  Follow the link and it will give you some examples of what to do.

     

    If you want something a bit more built in, I have a script extension I wrote that puts some wrappers around it.  You can down load it here . If you need help implementing that extension, let me know via PM.

2 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    SQL Queries can be run using the ADO objects built in to TestComplete specifically the CreateADOQuery method.  Follow the link and it will give you some examples of what to do.

     

    If you want something a bit more built in, I have a script extension I wrote that puts some wrappers around it.  You can down load it here . If you need help implementing that extension, let me know via PM.

    • WillClarke's avatar
      WillClarke
      Occasional Contributor

      Awesome, thanks dude with the follow up PM. Everything is cool