问题描述
嗨!
我正在尝试计算特定月份中表中的所有条目,但是我不知道这是我的代码:
字符串cmdStr =从tranzactii中选择计数(*),其中COD_CLIENT =""+ Convert.ToInt32(GridView1.SelectedRow.Cells [0] .Text)+"''和 DATA_TRANZACTIE(Month) = ""+ luna_precedenta +"'';
SqlCommand VerificaUtilizator =新的SqlCommand(cmdStr,cubexiune);
................................................... .................
DATA_TRANZACTIE -这是我表中的datetime变量,而 luna_precedenta 是我要引用的月份.
请有人可以帮助我..
对不起,英语不好.
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
推荐答案
MONTH(DATA_TRANZACTIE)
会以整数形式返回月份.
That returns the month as an integer.
这篇关于如何在数据库表asp.net中引用特定月份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!