|
-
May 26th, 2007, 07:05 AM
#1
Thread Starter
Addicted Member
sql select statement
Hi gurus
I posted this question on .net forum ealizing it was the wrong forum too late, my apol.to the .net forum.
here is my question.
I have a select statement (select * from table) how can I check if the select statement ruturn a row,rows or nothing.
Thanks gurus
-
May 26th, 2007, 07:06 AM
#2
Re: sql select statement
Please show us the code you are using to actually execute that select statement.
-
May 26th, 2007, 05:12 PM
#3
Thread Starter
Addicted Member
Re: sql select statement
thanks for the help
I have so far the following
Code:
stringcommand1=select * from table where field = variable
osqlcommand = New SqlCommand
osqlcommand.CommandText = stringcommand1
osqlcommand.CommandType = CommandType.Text
osqlcommand.Connection = osqlconn
osqlcommand.ExecuteNonQuery()
I need to check if my select statement return any rows as sometimes there is no value to be returned from my table
Thanks again
-
May 26th, 2007, 06:44 PM
#4
Re: sql select statement
Using a ExecuteNonQuery command is normally used to update data, delete data or preform some other Data Definition Language on the database. To return data you normally use a Datareader or a Dataset. If you use a datareader you can use the .HasRows() property to see if any rows are returned from the database.
Sometimes the Programmer
Sometimes the DBA
Mazz1
-
May 26th, 2007, 08:52 PM
#5
Thread Starter
Addicted Member
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
|