Friday 9 March 2012

Length for data type nvarchar(max) in ADO.Net parameter collection

I had a SQL Server based stored procedure with an output parameter of type nvarchar(max). Issue we faced was what length of this variable length parameter should be set in the ADO.NET parmater collection.
Answer is length for such data types could be set to -1 in the parameters collection as follows:

oDatabase.AddOutParameter(oDbCommand, "@RegionNotDeleted", DbType.String,-1);

No comments:

Post a Comment