Error when sending large image to SQL Server via ADO.NET & Stored Procedure

Error when sending large image to SQL Server via ADO.NET & Stored Procedure

Post by Bria » Sat, 08 Jun 2002 10:57:17


Hello,

I have an application that stores images in the database. I use SQL Server
2000 and VB.NET.  I have a table with a column of type image.  I also have a
stored procedure that does the insert with a parameter of type image.  The
local data type being passed to the stored procedure is a byte array
(byte()).

A 6k image stores just fine. At 32k, I get the following error:

---------------------------------------------------
A severe error occurred on the current command. The results, if any, should
be discarded. at
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior,
RunBehavior runBehavior, Boolean returnStream) at
System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
---------------------------------------------------

And, if I look in the event viewer, I see that MSSQLSVR reports the
following error:

---------------------------------------------------
Error: 17805, Severity: 20, State: 3
Invalid buffer received from client.
---------------------------------------------------

Has anyone seen this? I found some old support documents talking about
problems with SQL Server 6.5, but nothing on SQL Server 2000 (which is what
I use).

Thanks!

Brian

 
 
 

Error when sending large image to SQL Server via ADO.NET & Stored Procedure

Post by Bria » Sat, 08 Jun 2002 11:20:26


I want to add.... that everything works fine without a stored procedure.....


Quote:> Hello,

> I have an application that stores images in the database. I use SQL Server
> 2000 and VB.NET.  I have a table with a column of type image.  I also have
a
> stored procedure that does the insert with a parameter of type image.  The
> local data type being passed to the stored procedure is a byte array
> (byte()).

> A 6k image stores just fine. At 32k, I get the following error:

> ---------------------------------------------------
> A severe error occurred on the current command. The results, if any,
should
> be discarded. at
> System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior
cmdBehavior,
> RunBehavior runBehavior, Boolean returnStream) at
> System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
> ---------------------------------------------------

> And, if I look in the event viewer, I see that MSSQLSVR reports the
> following error:

> ---------------------------------------------------
> Error: 17805, Severity: 20, State: 3
> Invalid buffer received from client.
> ---------------------------------------------------

> Has anyone seen this? I found some old support documents talking about
> problems with SQL Server 6.5, but nothing on SQL Server 2000 (which is
what
> I use).

> Thanks!

> Brian


 
 
 

Error when sending large image to SQL Server via ADO.NET & Stored Procedure

Post by Mikae » Sat, 08 Jun 2002 15:00:03


I had a similar problem with text and ntext.

When adding the parameter to the Stored Procedure you have
to make sure that you set the type to SqlDbType.image AND
you have to set the size to the actual size of your image.
If your image is 33000 bytes, set the size to 33000.

Works for me, but I dont understand why I have to set the
size.

Regards,
Mikael

Quote:>-----Original Message-----
>Hello,

>I have an application that stores images in the database.
I use SQL Server
>2000 and VB.NET.  I have a table with a column of type

image.  I also have a
Quote:>stored procedure that does the insert with a parameter of
type image.  The
>local data type being passed to the stored procedure is a
byte array
>(byte()).

>A 6k image stores just fine. At 32k, I get the following
error:

>---------------------------------------------------
>A severe error occurred on the current command. The

results, if any, should
Quote:>be discarded. at
>System.Data.SqlClient.SqlCommand.ExecuteReader

(CommandBehavior cmdBehavior,
Quote:>RunBehavior runBehavior, Boolean returnStream) at
>System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
>---------------------------------------------------

>And, if I look in the event viewer, I see that MSSQLSVR
reports the
>following error:

>---------------------------------------------------
>Error: 17805, Severity: 20, State: 3
>Invalid buffer received from client.
>---------------------------------------------------

>Has anyone seen this? I found some old support documents
talking about
>problems with SQL Server 6.5, but nothing on SQL Server
2000 (which is what
>I use).

>Thanks!

>Brian

>.

 
 
 

Error when sending large image to SQL Server via ADO.NET & Stored Procedure

Post by Brian Stewar » Sun, 09 Jun 2002 03:59:16


Thanks Mikael -- by setting the size, do you mean the parameter definition?
I can't check right now, but I don't think data type image has a size
parameter.

B


Quote:> I had a similar problem with text and ntext.

> When adding the parameter to the Stored Procedure you have
> to make sure that you set the type to SqlDbType.image AND
> you have to set the size to the actual size of your image.
> If your image is 33000 bytes, set the size to 33000.

> Works for me, but I dont understand why I have to set the
> size.

> Regards,
> Mikael

> >-----Original Message-----
> >Hello,

> >I have an application that stores images in the database.
> I use SQL Server
> >2000 and VB.NET.  I have a table with a column of type
> image.  I also have a
> >stored procedure that does the insert with a parameter of
> type image.  The
> >local data type being passed to the stored procedure is a
> byte array
> >(byte()).

> >A 6k image stores just fine. At 32k, I get the following
> error:

> >---------------------------------------------------
> >A severe error occurred on the current command. The
> results, if any, should
> >be discarded. at
> >System.Data.SqlClient.SqlCommand.ExecuteReader
> (CommandBehavior cmdBehavior,
> >RunBehavior runBehavior, Boolean returnStream) at
> >System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
> >---------------------------------------------------

> >And, if I look in the event viewer, I see that MSSQLSVR
> reports the
> >following error:

> >---------------------------------------------------
> >Error: 17805, Severity: 20, State: 3
> >Invalid buffer received from client.
> >---------------------------------------------------

> >Has anyone seen this? I found some old support documents
> talking about
> >problems with SQL Server 6.5, but nothing on SQL Server
> 2000 (which is what
> >I use).

> >Thanks!

> >Brian

> >.

 
 
 

Error when sending large image to SQL Server via ADO.NET & Stored Procedure

Post by Frans Boum » Sat, 15 Jun 2002 06:50:58



> Hello,

> I have an application that stores images in the database. I use SQL Server
> 2000 and VB.NET.  I have a table with a column of type image.  I also have a
> stored procedure that does the insert with a parameter of type image.  The
> local data type being passed to the stored procedure is a byte array
> (byte()).

> A 6k image stores just fine. At 32k, I get the following error:

> ---------------------------------------------------
> A severe error occurred on the current command. The results, if any, should
> be discarded. at
> System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior,
> RunBehavior runBehavior, Boolean returnStream) at
> System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
> ---------------------------------------------------

> And, if I look in the event viewer, I see that MSSQLSVR reports the
> following error:

> ---------------------------------------------------
> Error: 17805, Severity: 20, State: 3
> Invalid buffer received from client.
> ---------------------------------------------------

> Has anyone seen this? I found some old support documents talking about
> problems with SQL Server 6.5, but nothing on SQL Server 2000 (which is what
> I use).

    Do you specify a length for the buffer you send (in the parameter declaration)?

        FB

 
 
 

Error when sending large image to SQL Server via ADO.NET & Stored Procedure

Post by Frans Boum » Mon, 17 Jun 2002 18:31:35




Quote:> Hello,

> I have an application that stores images in the database. I use SQL
> Server 2000 and VB.NET.  I have a table with a column of type image.  I
> also have a stored procedure that does the insert with a parameter of
> type image.  The local data type being passed to the stored procedure is
> a byte array (byte()).

> A 6k image stores just fine. At 32k, I get the following error:

> ---------------------------------------------------
> A severe error occurred on the current command. The results, if any,
> should be discarded. at
> System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior
> cmdBehavior, RunBehavior runBehavior, Boolean returnStream) at
> System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
> ---------------------------------------------------

> And, if I look in the event viewer, I see that MSSQLSVR reports the
> following error:

> ---------------------------------------------------
> Error: 17805, Severity: 20, State: 3
> Invalid buffer received from client.
> ---------------------------------------------------

> Has anyone seen this? I found some old support documents talking about
> problems with SQL Server 6.5, but nothing on SQL Server 2000 (which is
> what I use).

        Do you supply the right size of the imagedata (in bytes) to the
        stored procedure's image parameter? If you don't, the image gets
        chopped of and/or will cause other errors.

--
        FB

        Get my free, open source .NET software at:      
        http://www.sd.nl/software

 
 
 

1. ADO.NET via VB.NET error with stored procedures using Temp tables

I have an issue with the SQLDataAdapter returning an error
'Invalid Object #P1" .#P1 is a temp table. for a better
under standing  of what the stored procedure is structured
like see the attached file. I have used the temp table
method for a very long time and the sql 7 and 2000 engine
can handle the temp table structure just fine . Why would
MS violate their own standards in ADO.net and the
SQLDataAdapter Control ?

THis is very frustrating as I am trying to migrate a
system written in vb6 to .Net and these stored procedures
worked fine with the older ado 2.6 under vb6.

Jon O Roberts

2. Desert Safari - Fareed wearThobe (Arabic Dress)

3. Calling a stored procedure on SQL Server using ADO.NET

4. Personal Laserwriter - Help!

5. how to receive a cursor returned by sql server's stored procedure using ADO.NET

6. Joining a 4.0 Domain

7. Stored Procedure, ADO.NET (VB) Error handling and generating error messages.

8. Random Win2K Pro Freezes

9. Dynamic SQL Stored Procedures Timeout in ADO.NET

10. Xml Parsing Error sending valid Xml to stored procedure from ADO.Net / C#

11. (Encrypted) "Stored Procedure does not exist" -- error returned when called by ADO.NET

12. Send MS SQL Server 2005 stored procedure a variable from within a C# application

13. Importing Excel file via ADO.NET from aspx then into SQL Server??