Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What is the return value of record set object,when value in data base does not exist?
#3
Solved: 11 Years, 3 Months, 4 Weeks ago
Saket solution will lead you to what you need. If you want to know the other way of finding wether it returned a value or not then you can try the below,

Code:
oCount = 0

While Not oRS.EOF
msgbox oRS.Fields.Item(1).Value
oCount = oCount + 1
oRS.MoveNext

Wend

msgbox oCount ' This will give you the total number of rows returned. if it 'has no rows then it will return zero.


On the Contrary you may try even this, This will give you the exact value returned from the RecordSet executed query.

Code:
Set oDB = CreateObject("ADODB.Connection")
Set oRS = CreateObject("ADODB.RecordSet")

oDB.Open("provider=Sqloledb;server=servername;user id=userid;password=serverpassword;database=defaultdb")

oRS.Open "Select * from person where Name ="&"'"basanth"'" ,oDB,3 ,4, 1
msgbox oRS.RecordCount ' If no record exist it will return 0. If a record exist or number of record exist then it will return the rows count.
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply


Messages In This Thread
RE: What is the return value of record set object,when value in data base does not ex - by basanth27 - 08-26-2009, 05:42 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  General run error when Exist fails msacks 1 1,866 02-08-2019, 02:12 AM
Last Post: Ankur
  [UFT 12.52/VBScript] Test object exist, is visible and enabled before take an action sparkwanted 0 3,650 02-07-2017, 12:28 AM
Last Post: sparkwanted
  Childobject return wrong checkbox count.. VpnQTP 1 2,862 04-09-2015, 09:07 PM
Last Post: babu123
  how to find Excel file exist or not in vbscript code sree.85 3 11,253 08-22-2013, 11:42 AM
Last Post: akhandesh
  Remote server machine does not exist eroshan 5 14,258 05-06-2013, 06:03 PM
Last Post: Saket

Forum Jump:


Users browsing this thread: 1 Guest(s)