cancel
Showing results for 
Search instead for 
Did you mean: 

How to return the rows updated when running Updae statement in test complete VB script

SOLVED
GAutomation
Frequent Contributor

How to return the rows updated when running Updae statement in test complete VB script

When i execute the below function the update statement runs succesfully but it is not throwing how many rows was affected.

 

Function Sq_QryUdate(field,value )


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

Set Qry1 = CreateObject("ADODB.Connection")
Set myCommand = CreateObject("ADODB.Command" )

Qry1.Open = field 'Connection string passed from excel
Set myCommand.ActiveConnection = Qry1
myCommand.CommandText = value' Update statement passed in excel'
myCommand.CommandType = adCmdText
Qry1.Execute value
myCommand.Execute RecordsAffected,adExecuteNoRecords

Log.Message(myCommand.Execute(RecordsAffected,adExecuteNoRecords))

Qry1.Close
End Function
1 ACCEPTED SOLUTION

Accepted Solutions
TanyaYatskovska
Community Manager

Re: How to return the rows updated when running Updae statement in test complete VB script

Hi @GAutomation,

 

According to the MSDN pageRecordsAffected should return the number of affected records.

So, you can try posting its value to the test log:

Log.Message(RecordsAffected)

 

If this doesn't help, please post here your SQL query. 

---------
Tanya Yatskovskaya
SmartBear Community and Education Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️

View solution in original post

3 REPLIES 3
m_essaid
Valued Contributor

Re: How to return the rows updated when running Updae statement in test complete VB script

Hi,

Maybe by doing another query before this one with a select count(*) ?

TanyaYatskovska
Community Manager

Re: How to return the rows updated when running Updae statement in test complete VB script

Hi @GAutomation,

 

According to the MSDN pageRecordsAffected should return the number of affected records.

So, you can try posting its value to the test log:

Log.Message(RecordsAffected)

 

If this doesn't help, please post here your SQL query. 

---------
Tanya Yatskovskaya
SmartBear Community and Education Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️

View solution in original post

GAutomation
Frequent Contributor

Re: How to return the rows updated when running Updae statement in test complete VB script

Tanya,

I tried that and it is not returning any values. 

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