December 13, 2013 at 8:42 am
what exactly is returned to VB.NET from a called stored procedure when no data is found?
December 13, 2013 at 8:58 am
SqlBound (12/13/2013)
what exactly is returned to VB.NET from a called stored procedure when no data is found?
That depends on the procedure AND the .NET code. I will make some assumptions based on the title of your post.
Assuming your code is getting a DataSet AND that your procedure has a single select statement to return a single dataset...
If the above is true then you will get a DataSet with a single table that matches the definition of the query but it will not have any rows.
MyDataSet.Tables[0].Rows.Count = 0
MyDataSet.Tables[0].Columns.Count = the number of columns in the select statement in your procedure.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
December 13, 2013 at 10:50 am
You should post your replies here instead of private message.
All you need to do to check if there is no data returned is to look at the row count for the table.
if MyDataSet.Tables[0].Rows.Count = 0 then
'There are no rows
else
'There are rows
end if
--Not sure if my VB syntax is correct but it is close.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
December 13, 2013 at 10:53 am
It may also depend on what data you're returning. Are you looking for a set of records or a single value? If you can be more specific we can help.
Mark
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply