Click here to Skip to main content
16,022,538 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a form named report with two Raddatepicker first from date second to date,
when i input date in these two control i want to see the monthly report in which i <b>Want</b> to see the total number of files.

my table has following fields
1.id
2.file no
3.title
4.date recieving
5.reply date
6.reply to.

i have no idea about it.

please help me with code.
thanks in advnace
Posted
Updated 20-Feb-12 23:32pm
v3
Comments
OriginalGriff 21-Feb-12 5:00am    
And what is the problem?
What have you tried?
Aniket Yadav 21-Feb-12 5:04am    
Will You Please Elaborate What You Exactly Want To Do Here?
Varun Sareen 21-Feb-12 5:21am    
have you tried something till yet??

1 solution

if you want SQL Query, Try this.

Select Count(fileno) from yourtable where fromdate>='"+ DateTimePickerFrom.Text +"' and todate<='"+ DateTimePickerTo.Text +"'";

Using SqlParameter is a good method instead of passing values direct to the query.

Using Parameters
SqlCommand cmd=new SqlCommand();
cmd.Connection=yourConnection;
cmd.CommandText=Select Isnull(Count(fileno),0) from yourtable where fromdate>=@fromdate and todate<=@todate";
cmd.Parameters.Clear();
cmd.Parameters.AddWithValues("@fromdate",DateTimePickerFrom.Text);
cmd.Parameters.AddWithValues("@todate",DateTimePickerTo.Text);
Int64 FileCount=Convert.ToInt64(cmd.ExecuteScalar());

You will get the file count on the variable FileCount declared as long.
 
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