How To Insert A Picture Into The Database

Table of contents:

How To Insert A Picture Into The Database
How To Insert A Picture Into The Database

Video: How To Insert A Picture Into The Database

Video: How To Insert A Picture Into The Database
Video: How to Insert Images to MySQL and Display Them Using PHP 2024, May
Anonim

The content of databases (DB) is stored in tables, but the information is usually presented to the user in a more convenient form - forms and reports are created. For clarity, they include various images: photographs, pictures, emblems. It is more convenient to store graphic data in special fields of tables. Microsoft Access DBMS supports several options for loading images into the database.

How to insert a picture into the database
How to insert a picture into the database

Necessary

  • - Microsoft Access DBMS;
  • - a graphic file containing a picture.

Instructions

Step 1

Add an OLE object field to the database table. It is in this field that Microsoft Access can store images. Open the required database and in the "Tables" tab select the element where you want to place the image. Call the constructor for the table. Editing its structure, add one more field with the data type "OLE Object Field". Give it a name and save the base changes ("File" - "Save").

Step 2

Place an OLE object in the created cell of the field, i.e. the picture itself. To do this, open the table in view mode. You will see the added column. Place the cursor in the required cell and right-click to bring up the context menu. Select the Add Object command.

Step 3

In the dialog box that opens, activate one of the proposed options for adding. You can insert an existing graphic file or create it first in the appropriate editor and then link to the current database. In the first case, select in the Object Type field the application in which you want to create a new image, for example, Paintbrush Drawing. Click the OK button, the editor program will start at the same time. The introduction of the object into the database will end after you close the graphics application after creating the picture.

Step 4

To insert an existing picture into the table field, select the second option - activate the "Create from file" switch in the dialog box. Click on the "Browse …" button and specify the path and name of the graphic file with the image. It is desirable to have a picture on disk in.bmp or.dib format. If necessary, enable the "Link" checkbox in the window - this will allow the DBMS to track changes to the graphic file and reload the image in the table.

Step 5

Confirm the download of the file by clicking the OK button, then save the database itself. When you open a table in view mode, the OLE object field will display not the picture itself, but the inscription "Bitmap". The graphic image will be loaded from the table when the user creates and works with forms and reports.

Recommended: