|
-
May 25th, 2007, 05:25 PM
#1
Thread Starter
Addicted Member
select statement
Hi gurus
new to all this as can see on my previous threads.
I would like to check if a select statement return or does not return any result, I can get the select statement no problem but how do I go checking if there is or there is not any results returned
Thanks a bunch
-
May 25th, 2007, 05:36 PM
#2
Re: select statement
Case has an 'Else' construct.
Code:
Select Case xyz
Case 1
'Do something
Case 2
'Do Something else
Case Else
'Some other value was returned
End Select
-
May 25th, 2007, 07:57 PM
#3
Thread Starter
Addicted Member
Re: select statement(MOVED)
Thanks Bulldog
I am really sorry for not been more specific, what I meant with select statement was sql select statement, again I am sorry to have wasted your time this way.
Last edited by GUARO; May 26th, 2007 at 07:06 AM.
Reason: WRONG FORUM
-
May 26th, 2007, 01:03 PM
#4
Addicted Member
Re: select statement
umm you can try to open that SQL statement with RecordSet and transport it to a dataset as a table. And check what is in in that table or you can check errors too.
-
May 26th, 2007, 02:31 PM
#5
Re: select statement
I think there are as many ways to do this as there are queries. If you are using a datareader (ExecuteReader), then you can look at the HasRows property. If you are getting a single value (ExecuteScalar), then you can look at the return value. I suspect there is something like this for all options, and which one you choose depends not on the SQL statement, but on what you are doing with the SQL statement.
My usual boring signature: Nothing
 
-
May 26th, 2007, 03:46 PM
#6
Member
Re: select statement
I think you are looking for code like this after u excute ur select statment
Code:
Dim Dr as datareader
Dr = cmd.excutereader
if dr.hasrows = false then
' Do what u wanna do here if u don't get results
else
' Do what u wanna do here if u get results
end if
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|