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....

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 developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.