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,
On the Contrary you may try even this, This will give you the exact value returned from the RecordSet executed query.
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.
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.