如何在数据库表asp.net中引用特定月份 [英] How to refere a specific month in a database table asp.net

查看:86
本文介绍了如何在数据库表asp.net中引用特定月份的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!

我正在尝试计算特定月份中表中的所有条目,但是我不知道这是我的代码:

字符串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

推荐答案

尝试使用:
Try using:
MONTH(DATA_TRANZACTIE)


会以整数形式返回月份.


That returns the month as an integer.


这篇关于如何在数据库表asp.net中引用特定月份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆