Saving Binary files on the Client to the Image data type in SQL Server 
Author Message
 Saving Binary files on the Client to the Image data type in SQL Server


I have a binary file that is in a variant type variable. I need to place
this file in an image data type in SQL Server. The file is always less than
64kB in size .

How do I convert the file to a string (which can then be placed in an SQL
statement and passed to a stored procedure in SQL Server using a pass
through query).

I have been unsuccessful using the following function:

Public Function BinaryToString(varBinData As Variant) As String

Dim intColumn As Integer
Dim strTemp As String

strTemp = "0x"
For intColumn = 1 To 16
    strTemp = strTemp & _
    Right$("00" & Hex(AscB(MidB(varBinData, intColumn, 1))), 2)

Next intColumn
BinaryToString = strTemp

End Function

Thank you

Martin Fine

Sydney Australia

Fri, 11 May 2001 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. How save JPG file in SQL Server image or binary field

2. Store the image in picture box control into the image data type in SQL server

3. Convert MSWord file into binary and save in sql server

4. Sql server Image data type

5. How to insert SQL Server Image Data Type Fields in a Report

6. Retrieving an Image from SQL Server Image column (binary)

7. Saving BMP files in SQL Server image fields

8. Loading binary data file into SQL Server

9. How to save JPG files in SQL Server image field

10. Save image in Sql Server and retrieve image from sqlserver to vb


12. SQL Server Image data to a file


Powered by phpBB® Forum Software