How to execute this T-SQL command through a c# method so that I can get the next ID of a Table?
declare @IDColumnName as varchar(150)
declare @TableName as varchar(150)
declare @SQL as nvarchar(1000)
declare @returns as int
set @IDColumnName = 'ID'
set @TableName = 'User'
set @returns = -1
set @SQL = 'select MAX([' + @IDColumnName + ']) from [' + @TableName + ']'
--print @SQL
EXEC @returns = sp_executesql @SQL
--print @returns