[C#] What size do you use for varchar(MAX) in your parameter declaration?


For those of us who did not see -1 by Michal Chaniewski, the complete line of code:

cmd.Parameters.Add("@blah",SqlDbType.VarChar,-1).Value = "some large text";

I normally set my column size when creating a parameter in ADO.NET

But what size do I use if the column is VARCHAR(MAX)?

cmd.Parameters.Add("@blah", SqlDbType.VarChar, ?????).Value = blah;

You do not need to pass the size parameter, just declare Varchar already understands that it is MAX like:

cmd.Parameters.Add("@blah",SqlDbType.VarChar).Value = "some large text";