cancel
Showing results for 
Search instead for 
Did you mean: 

how to run the update statement in test complete

SOLVED
Frequent Contributor

how to run the update statement in test complete

VB script

 

Function Sq_QryUdate(field,value )
'Create a query

Set Qry1 = ADO.CreateADOConnection

'Specify the connection string

Qry1.ConnectionString = "Provider=IBMDA400.DataSource.1;Persist Security Info=False;User ID=XXX;Password=XXX;Data Source=XXX"

Qry1.Open()
'Specify the SQL expression
Qry1.Execute="Update statement"
Qry1.Close()


 

The above does not work as expected.

1 ACCEPTED SOLUTION

Accepted Solutions
Frequent Contributor

Re: how to run the update statement in test complete

Got it worked. I went to database checkpoint and try connecting and ran teh code again without any changes it worked. not sure what the issue was. but its working.

 

View solution in original post

8 REPLIES 8
Community Hero

Re: how to run the update statement in test complete

What were you expecting?  Syntax wise, you have it incorrect.   It should be

 

Qry1.Execute("<the sql statement to be executed>")

 

See https://support.smartbear.com/testcomplete/docs/reference/program-objects/ado/createadoconnection.ht...

 

 


Robert Martin
[Community Expert Group]
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
Extensions available
Highlighted
Community Hero

Re: how to run the update statement in test complete

Just as a side note... the online documentation for TestComplete that I've been linking you to is pretty well written with code examples and such in multiple languages.  If you haven't done so already, I'd highly recommend two things.

1) Take a look at the internal documentation for TestComplete for using ADO for connectivity.  Several topics in the help files cover the different methods.  For the ADO object you are using, you can start here https://support.smartbear.com/testcomplete/docs/reference/program-objects/ado/index.html

 

2) That link I sent you has several links embedded which will take you to other specific documentation for the Microsoft and Borland ADO objects and methods.  


Robert Martin
[Community Expert Group]
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
Extensions available
Frequent Contributor

Re: how to run the update statement in test complete

I am getting an error checksynchronize called from  thread $1888, which is not the main thread and i have to kill test complete  when i get this error.

Community Hero

Re: how to run the update statement in test complete

See my suggested correction above.  Did that work for you?


Robert Martin
[Community Expert Group]
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
Extensions available
Frequent Contributor

Re: how to run the update statement in test complete

Yes Sir. I tried with correcting the error and was getting that error.

same connection works for select statement.

Valued Contributor

Re: how to run the update statement in test complete

Make sure that the user you use for connection has necessary privileges (to run UPDATE SQL queries)

Frequent Contributor

Re: how to run the update statement in test complete

When i tried running the same query manually in data base it runs with no issue. Basically the issue opens ont he line

qry1.Open()

the database login opoup opens and enters the username but not entering the password.

 

the password given is the right one. verified it.

and then throw check synchronize called error.

Frequent Contributor

Re: how to run the update statement in test complete

Got it worked. I went to database checkpoint and try connecting and ran teh code again without any changes it worked. not sure what the issue was. but its working.

 

View solution in original post

New Here?
Join us and watch the welcome video:
Top Kudoed Authors