Dim b
b=Replace("QTP","P","T")
msgbox b
Output-QTT
Dim a,b
a="Software Testing"
b=Replace("Software Testing","Software","Manual")
msgbox b
Output-Manual Testing
QTP Script to Replace a word in a string with another word-Replace VBScript Function example-scripts in qtp-Replace function example-vbscript function
To Retrieve Column Names From Database Table in QTP-VBScript To Get Column Names From Table Present in Database
VB Script to get column names from database table(MS Access).
We have table "EMP" in database "db"(Microsoft Access).
EMP Table has following data in it.
EMPNO EMPNAME EMPSAL
1 Lakshmi 30,000
2 Laxmi 25,000
3 Latha 15,000
Check This Blog For SQL Queries
Dim con,rs
Set con=createobject("adodb.connection")
Set rs=createobject("adodb.recordset")
con.provider="microsoft.jet.oledb.4.0"
con.open"d:\db.mdb"
rs.open"select*from EMP",con
For i = 0 To rs.Fields.Count - 1
column_name=rs.Fields(i).Name
Msgbox column_name
Next
Output:
EMPNO
EMPNAME
EMPSAL
SQL Queries Collection
QTP Script for Connecting to database
QTP Script to export database data to excel sheet
QTP Script to import database data to datatable
Connecting to MSAcess,Oracle,SQL Server Database
Hindi and Telugu Songs Lyrics
using for loop in qtp
In computer science a for loop is a programming language statement which allows code to be repeatedly executed.
Syntax is:
For a = b to c [step d]
statements
Next
where step d is optional.value of d is 1 by default.1 is incremented everytime in loop.
for example:
for i=1 to 5
msgbox i
Next
Output will be 1,2,3,4,5
For i=1 to 5 step 2
msgbox i
Next
Output will be 1,3,5
here 2 is incremented every time.
Data Driven Testing
SQL Queries Collection
VB Script to display a random number from 0-100
Script to display random number from 0 to 100
x=randomnumber.Value(0,100)
msgbox(x)