Click here to Skip to main content
15,911,139 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
hye! i can find out or fetch out data betn two dates but i wanna ....if there is no data betn two dates then how can i show the message that there is no data in ur database that in selected dates.......can any one help me to do that plz.....
Posted
Comments
Sergey Alexandrovich Kryukov 14-Nov-11 15:18pm    
Tag it properly. If this is about CrystalReports, tag it.
--SA

Depends on how you are retrieving the records.
If you are using an SqlCommand object and an SqlDataReader, then check the DataReader.HasRows[^] property.

If not, what are you using?
 
Share this answer
 
Comments
sammsul 14-Nov-11 14:32pm    
i use Crystalreport for retrieving the records ....when i passing two dates from my app. to SQl database ...if passing dates get any data bet two dates then showing with data and also without data some time...but i do not want to show crystalreport if there is no data in my database then what i do...help me plz
OriginalGriff 14-Nov-11 14:50pm    
I don't use Crystal reports so I don't know if there is a way to say "don't bother reporting if you have no data".
Personnally, I would check the DB directly:
SELECT COUNT(*) FROM MyTable WHERE dateColumn BETWEEN @START AND @END
Execute that as a scalar and it will give you just the count.
if Datagridview1.rowcount=0 then

msgBox ".........."

End If
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900