Click here to Skip to main content
15,919,434 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi!

I am trying to count all the entrys in the table with a specific month, but i don't know how this is my code:

string cmdStr = "select count (*) from tranzactii where COD_CLIENT = '" + Convert.ToInt32(GridView1.SelectedRow.Cells[0].Text) + "' and DATA_TRANZACTIE(Month)='" + luna_precedenta + "'";

SqlCommand VerificaUtilizator = new SqlCommand(cmdStr, conexiune);

...................................................................
DATA_TRANZACTIE - this is my datetime variable in my table and luna_precedenta is the month i want to refere.

Pls can someone help me..

sorry for the bad english
Posted

1 solution

Try using:
MONTH(DATA_TRANZACTIE)

That returns the month as an integer.
 
Share this answer
 
Comments
Mitran Stefanita Alexandru 3-Jul-11 16:47pm    
thks that worked

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