Hii
I am new to C#.net
I have a application in which i have search option(Button)
I first want to check in database if any data is available which user has entered for search.
if it is i want to show that data
otherwise i want to display an error message.
i know this can be done by count function but i am confused how to use it and how to use it to check in if condition
Please help me in this problem
Thanks in advance
Rahul patel
Loading
Bruce RoeserPosted Aug 15, 2010, 9:50 AM
Assuming you retrieved the record count in a variable called "recordCount" ...
MessageBox.Show("There are" + recordCount + " records in the database that match your query.");
There are variants of the MessageBox.Show() function that allow you to place a caption, icon and select buttons but your online documentation details that.
If I may suggest - it seems like you might benefit from studying C# a little while before trying to use it to develop an application. There are a number of good tutorial books on the market.
-bruce
CSharp DotNetPosted Aug 15, 2010, 12:27 AM
Thanks for ur reply
I know it can be done by count function but i dont know how to use it to display number of rows in messagebox.show. as i am new to c#.net
Please help me..
Thanks in advance..
Bruce RoeserPosted Aug 12, 2010, 4:12 PM
"SELECT COUNT(*) FROM [table name] WHERE [conditions]"
I.E.
SELECT COUNT(*) FROM Customers WHERE yearlyspending > 250
This will return in one column the number of customers that satisfy the query.
If you're looking for something more specific you're going to need to be more specific.
-b