I'm a beginner to C# and going to develop a application using C# and SQL server 2005. one of my tables has a field named with DATE. data type is also 'datetime'. i can insert data to the database using my application properly. now i want to filter my data, according to month.
Eg: i want to get monthly expenditures.
Actually i don't have an idea to do this. So how to filter according to month.... Please help me....

Recommended Answers

You need basic SQL queries if I understood your problem right.

Jump to Post

All 2 Replies

You need basic SQL queries if I understood your problem right.

hi..

you can go for passing query using c#

here comes sql query :

"Select * from tablename where fieldname between fromdate and todate "


in c# you can go for particular controls to fetch fromdate and todate

commandobj.commandText = "select * from tablename where expediture between '"+controlname+"' and '"+controlname+"'
commandobj.executenonquery();

Hope this will help you...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.