Error: 17805, Severity: 20, State: 3 Invalid buffer received from client
If you had configured alerts in SQL Server for SEV 20 you
might receive alerts if such an event occurred at SQL Server instance, so what
exactly is this error all about? Which has caused this and what is the
resolution? Below are the details…
1.)
In the application code C# or VB if datatype is
not specified for the parameters then
.NET framework will try to select correct datatype based on the data that is
passed and if that is unsuccessful above error is raised. So it is always
recommended to define the datatype of the parameters for SqlParameter object in
application programming.
2.)
Another reason is if the size parameter is
incorrectly specified i.e more than the maximum length allowed by the SQL
server then this error will occur.
Ex: nvarchar is a
variable-length Unicode character data of n characters. "n" must be a
value from 1 through 4000. If you specify a size that is more than 4000 for
an nvarchar parameter, you receive the above error message
3.)
Final cause is, declaring an instance of
the SqlClient class to be static in C# or to
be shared in Visual Basic. The instance can be accessed
concurrently from more than one thread in the application. Causing above error
Resolution:
So overall to eliminate these errors we need to
follow below guidelines…
ü Specify
the SqlDbType enumeration for the SqlParameter object so
that there is no inferred type.
ü Specify
a parameter size that is within the limits of the data type.
ü Do
not use a SqlClient class in a Finalize method or in a C# destructor.
References:
No comments:
Post a Comment