Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 how to insert multiple images in single query

Author  Topic 

Abid

110 Posts

Posted - 2015-05-07 : 01:53:23
HI. I want to work upon the concept for the first time. The situation is that I have a hotel table, fields are Hotel_ID, Hotel_Name, Hotel_Pic.

What i want is that when user click on the image of the hotel so a separate form or page is open where all the related images of that hotel are displayed in a table format.

I want to know that how to implement this concept?
How many tables i would be needing for this.

Kindly guide me to get through this and let me to learn some more sql programming.

Kristen
Test

22859 Posts

Posted - 2015-05-07 : 05:16:25
In this situation I store the images on the Disk and store the Filename (and maybe the Path to the file) in the database.

I would have a table with columns like this:

Table: HotelPhoto

Columns:
Hotel_ID
ItemNo (or could just use IDENTITY) - just a unique number for each photo, for each hotel
FileName
optionally: FilePath

Primary Key: Hotel_ID, ItemNo

If the sequence that the photos are displayed in is important I would use ItemNo so that Admin can adjust the ItemNo for a given Hotel_ID into the sequence that the photos should display. At the least Photo ItemNo=1 may be important to indicate the "Main image". Or you could have a BIT column "MainPhoto" that handled that.
Go to Top of Page
   

- Advertisement -