c#提取月份无值

时间:2013-04-23 19:09:17

标签: c# sql oledb extract

我遇到了[]错误以及此错误IErrorInfo.GetDescription failed with E_FAIL(0x80004005)的问题。现在我将EXTRACT(MONTH form table)放在[]括号中,现在程序说没有给出一个或多个参数的值。

租用是代码:

string queryString = "SELECT sum(skupaj) FROM [cas] where sifra = " + textBox1.Text + " and [EXTRACT(MONTH FROM Datum)] = " + textBox2.Text + "";

1 个答案:

答案 0 :(得分:0)

如果您使用的是SQL Server,则最终查询应如下所示:

SELECT sum(skupaj) 
FROM [cas] where sifra = 123 
and MONTH(Datum) = 4