このコードを使用して、db からデータを選択しようとしています:
getForecastsCommand.CommandText = @"SELECT TOP @Count * FROM Forecasts Order by [ForecastId] DESC";
var countParam = getForecastsCommand.CreateParameter();
countParam.ParameterName = "@Count";
countParam.Value = count;
countParam.DbType = DbType.Int32;
getForecastsCommand.Parameters.Add(countParam);
しかし、それはうまくいきません:
Incorrect syntax near '@Count'.
うまくいかないのはなぜですか?