これが私のコードです:
#region Validate and prepare parameters
if (month > 12)
{
throw new ArgumentException("Value of 'month' could not be greater than 12.");
}
int yearEnd = year;
int monthEnd = 0;
if (month != 12)
{
monthEnd = month + 1;
}
else
{
monthEnd = 1;
yearEnd = year + 1;
}
#endregion
MyModelDataContext context = new MyModelDataContext();
string sql =
@"select SUM(ORDERQTY * MULTIPLIER) AS VOL_USD
from Executions with (nolock)
where TRANSACTTIME >= '{0}-{1}-01 00:00:00'
and TRANSACTTIME < '{2}-{3}-01 00:00:00'
and MTCONTEXT in (5,6)
and ORDERQTY > 0
AND SOURCE = 'INTMT'
and LEFT(SYMBOL, 3) = 'USD'";
decimal usd___Sum = context.ExecuteQuery<decimal>(sql, year, month, yearEnd, monthEnd).First();
私は例外を取得しています:
文字列から日時を変換する際に変換に失敗しました。
ExecuteQueryメソッドを呼び出すとき。year の値は 2013 で、month の値は 9 です。何が間違っていますか?
前もって感謝します。