Last post Mar 13, 2008 02:24 PM by bobmmp
Mar 13, 2008 11:37 AM|tuffcorey|LINK
I am writing a very simple web app to search a access database and return the results. I need to have it return "results not found" when nothing is found and I'm not sure exactly how to do this. Thank you.
Mar 13, 2008 12:08 PM|shawpnendu|LINK
Just read the below two links:
HOPE u can start coding. I can give you sample code but better find out ur solution from above links.
MARK AS ANSWER if its helped you.
Mar 13, 2008 12:09 PM|HosamKamel|LINK
Just execute your search which for example returns a dataset and in your binding control for example GridView , there is an EmptyTemplate set the needed text inside it
this will let the GridView displays this text when no data found
Display something when there is GridView is empty
Mar 13, 2008 12:09 PM|Mikesdotnetting|LINK
Depends on how you are accessing the database. If you are using ADO.NET code and returning a DataReader, you can test to see if the Reader.HasRows. If not, there are no results. If you are using an Access- or SqlDataSource control, you can get the count
of e.AffectedRows in the control's Selected event. If it's 0, there are no results. In either case, just apply the text "No Results Found" to a label control or something.
Mar 13, 2008 12:29 PM|bobmmp|LINK
What are you using to show your data, a gridview? ListView?
Using Visual Studio, with your data controls there is EmptyDataText
Mar 13, 2008 02:15 PM|tuffcorey|LINK
Got it working using EmptyDataText. Thank you.
Mar 13, 2008 02:24 PM|bobmmp|LINK
Your welcome.. you might want to mark the post as the answer so it shows the post an answered.