Link to home
Start Free TrialLog in
Avatar of narfk1
narfk1

asked on

How Insert a Picture Into SQL Server 2000?

How do I insert a Image file into a field, of image type? There is no insert button as in Access ???
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Access is both a (small) database + a GUI development application.
SQL Server is ONLY a (full-blown) database product, and doesn't have a true user GUI, EM and QA are only Developer & Admin tools.
If you want to insert pictures into a image column, you either need to develop an application that can do this via code, or eventually play around with the TextCopy.exe, which can read a file into a IMAGE or TEXT column.

CHeers
Avatar of lschweer
lschweer

Hi narfk1,

angel is right. You can't insert images directly into the SQL Server using the Enterprisemanager.

But you still can use ADO to insert the File. Use the AppendChunk and GetChunk methods of a field. Do the following steps

1.) open recordset
2.) open file and copy to membuffer (you can do that from the file directly as well)
3.) call the append chunk methods for the image field until your file is insterted
4.) Update the record

Your file is now inserted in SQL Server

Check out MSDN Documentation for further information. There is also an example inserting images. Look at
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rdo98/html/rdproappendchunkx.asp


Lars
It's recommended that you should not store an image directly in SQL Server. Although this can be done (e.g. using IMAGE datatype), it's best to only store the path to the image file in the database. Then, when your front-end application queries the database, it retrieves the file path of the image, and then goes there to open it for display.

Avatar of narfk1

ASKER

Angelll I tried using the textcopy.exe program to insert a picture into the database, but it doesn't seem to work. Sorry but Im new to database, but maybe im not inputting the right commands. What would I input when the program asks me to Type the Where clause: ? I only have three column in the Table called PICTURE. 1) ID 2)Person 3)Pict
so would i put the select * FROM PICTURE WHERE ID = '1' or something of that nature??
narfk1:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I will leave the following recommendation for this question in the Cleanup topic area:
    PAQ with points refunded

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

monosodiumg
EE Cleanup Volunteer
ASKER CERTIFIED SOLUTION
Avatar of Computer101
Computer101
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial