Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL SP4 & image

Status
Not open for further replies.

draganss

Programmer
Jan 13, 2006
47
MK
VS.NET 2002
SQL 2000 with SP3 or SP4
//////////////////////////
//////////////////////////
I'm creating an image of an barcode with following code:

Private Shared Function CreateImage(ByVal strBarKod As String, ByRef arrImage() As Byte) As Boolean
Dim graphic As Graphics
Dim pb As New PictureBox()
Dim ms As New MemoryStream()
Dim Drawing As Bitmap

graphic = pb.CreateGraphics()
Drawing = New Bitmap(pb.Width, pb.Height, graphic)
graphic = Graphics.FromImage(Drawing)
graphic.FillRectangle(Brushes.White, 0, 0, pb.Width, pb.Height)
Call SomeFunction(graphic, strBarKod, 12, 0, 1, 40)

pb.Image = Drawing
pb.Image.Save(ms, Imaging.ImageFormat.Jpeg)
arrImage = ms.GetBuffer
ms.Close()

Return True
End Function
///////////////////////////
///////////////////////////
Later I'm passing the arrImage to the SQL Stored Procedure which inserts it to the database.

ALTER PROCEDURE sp_InsertBarCode
@ImgBarCode image=null,
AS
INSERT INTO BarCodeTable(ImgBarCode)
VALUES(@ImgBarCode)
RETURN @@ERROR

When I'm using this code with SQL database with SP2 or SP3 I can insert images up to ~30 KB large,
but with SQL database with SP4 images can be maximum 4 KB large.
Error I'm getting is:
A severe error occured on the current command. The result, if any, should be discarded.
The field in the table is defined as Data Type Image with Lenght=16.
////////////////////////
////////////////////////

Any suggestions?
Thank you.

Marin
 
Check with Microsoft to see if there are any post SP4 related hot fixes. SP4 did correct a problem they were having with ntext, text and image datatypes, so it's possible they broke something else.

Here's a list of the bugs fixed with SP4.


Catadmin - MCDBA, MCSA
"No, no. Yes. No, I tried that. Yes, both ways. No, I don't know. No again. Are there any more questions?"
-- Xena, "Been There, Done That"
 
I'm glad you were able to get it fixed.



Catadmin - MCDBA, MCSA
"No, no. Yes. No, I tried that. Yes, both ways. No, I don't know. No again. Are there any more questions?"
-- Xena, "Been There, Done That"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top