So, in Sql server 2005 and above you can use parenthesis before and after you param.
Here you go:
SELECT TOP (@elements) * from tableCities
It is pretty easy, isn't it?
How to write code in C#, Asp.Net, Php, Javascript, C. On this blog you will find example codes that will help you to understand concepts of programming.
SELECT TOP (@elements) * from tableCities
///
/// Adds business days to a date
///
///
///
///
public static DateTime AddBusinessDays(this DateTime dateTime, int businessDays)
{
DateTime resultDate = dateTime;
while (businessDays > 0)
{
resultDate = resultDate.AddDays(1);
if (resultDate.DayOfWeek != DayOfWeek.Saturday &&
resultDate.DayOfWeek != DayOfWeek.Sunday)
businessDays--;
}
return resultDate;
}