Quality Testing

Quality is delighting customers

The total number of columns of the database can be found using rs.fields.count..

in the same way..

1)Can anybody tell how to calculate the total number of rows in the database in QTP??


2)how to do the validation for the textfields for both valid and invalid in a single action??

3)How to find the items count in the listfield in a we based application..

i tried with getitemscount(),,but was not able to get..




Views: 5409

Replies to This Discussion

Hi bhavana,

Hope this might help u....

1> to count total no of rows in database use recordcount method.

2> use excel parameterization

3> getitemscount can be used for windows based application.For web based application u have to use items count property of List field.

for ex..

count=browser("A").Page("B").WebList("C").GetROProperty("items count")
msgbox count



Thanks & Regards,

Tariful Islam 


Datatable.Getsheet("Sheet id").GetRowCount

We use the above syntax to get the rows present in an excel sheet. If we don't mention "GetSheet("Sheet Id")", It displays the no.of rows in the Global Sheet. So we need to mention from which sheet we need to count the rows.

Hi gopi,
Bhavana is asking about database not datatable......

Thanks & Regards,
Tariful Islam

 For Ms access

 Dim con,rs
set con = CreateObject("ADODB.Connection")
set rs =CreateObject("ADODB.recordset")
con.provider= "Microsoft.jet.oledb.4.0"
con.open "C:\d1.mdb"
rs.open "select * from students", con

Msgbox rs.RecordCount [ to get the total number of records]

I've connected to SQL..n my application is .net application..its returning -1 value..so please let me know some other function..



Let's Take this the other way round. Navigate thru each an every records, set a counter and increment it till the last record. like

myrecordcount = 0


While not (ors.EOF)

   myrecordcount = myrecordcount + 1



or if your are sure to have serial number in your table

then ors.MoveLast and extract the sr. no. column value ors.Fields("sr. no.").Value

Please elaborate Q2

For Q1:- use getroproperty("all items") and then using split function with delimiter ";" get an array and then  Ubound(array) + 1 is your item count. 


TTWT Magazine





© 2020   Created by Quality Testing.   Powered by

Badges  |  Report an Issue  |  Terms of Service