title: the max function requires 1 argument(s)
body: <p>I wrote this very simple SP in SQL 2008:  </p>
  
  <pre><code>Create procedure dbo.GetNextID 
  (
      @TableName nvarchar(50),
      @FieldName nvarchar(50)
  )
  AS
      BEGIN
          exec('select isnull(max('+@FieldName+'),0)+1 as NewGeneratedID from '+ @TableName);
      END
  </code></pre>
  
  <p>When I execute this procedure in <code>Visual Studio SQL Express</code> and pass a table name and a field name, it works fine. But when I try to add this SP as a query in a <code>QueryTableAdapter</code> in my <code>ADO DataSet</code>, I receive this error before clicking on <code>Finish</code> button:</p>
  
  <pre>the max function requires 1 argument(s)</pre>
  
  <p>can anyone help me with this?</p>