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
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