Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
using queries in functions (Store Procedures)
#2
Not Solved
Hi Samson,
you can not directly use a query to put in if condition.
you will need to exceute these query and compare the recordset.

steps you can follow -
1 connect to DB
2 execute your query
3 get the recordset
4 then compare the values

e.g in your case here

Code:
Dim oConnection,ConnectionString  , oRecordSet

ConnectionString ="<Connection string to Connect to DB>"  'refer https://www.learnqtp.com/qtp-database-part2-how-to-create-connection-strings/

Set oConnection = CreateObject("ADODB.Connection")  
Set oRecordSet = CreateObject("ADODB.Recordset")
oConnection.Open ConnectionString  
strSQL = "select l.Locality from TgnTerritorydtl tdtl, tgnLocality l, Tgncompany C where
l.localityid= tdtl.localityid and c.companyid=l.companyid and
c.company='company' and l.Locality='123'"
oRecordSet.Open strSQL,oConnection, adOpenStatic    

if oRecordSet.Fields("Locality").value <> null then 'or you can get the record count here if > 0 then locality exists
print "Locality Exists"
else
print "Locality Not Exists"
end if

while creating DBCheckpoint put the same query there.

Reply


Messages In This Thread
RE: using queries in functions (Store Procedures) - by Saket - 03-12-2010, 01:20 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  VB Script to separate upper & small Letters from a string and store in excel pradeep537 1 2,077 08-05-2016, 12:26 AM
Last Post: Ankur
  Perform some functions whenever QTP Stop button is pressed smartkarthi 2 2,950 08-22-2013, 11:43 AM
Last Post: smartkarthi
  exit parent functions as well Shridevi.Salagare 3 3,607 07-31-2013, 12:15 AM
Last Post: Ankur
  Datatable in functions shwetasharma 2 3,300 03-26-2013, 08:00 AM
Last Post: sams001
  Problem with using two functions in the same action mhanaan 2 2,858 09-14-2012, 10:09 PM
Last Post: mhanaan

Forum Jump:


Users browsing this thread: 1 Guest(s)