Reputation: 3051
In a Software for bodybuilding gym,i should save more than one picture for each athlete(number of pictures is not defined).
i think one way can be save addresses of pictures in a field and split them with for example ,
Is there any other better way?
Upvotes: 0
Views: 176
Reputation: 437
If you meant saving their paths in memory, then How about a list?
List<string> Portfolio = new List<string>();
Portfolio.Add(imagePath1);
//etc..
If you meant saving in SQL-database, Use a table with columns as shown below.. you can store any number of images you want in there for any given AtheleteId.
Create Table ProfileImages
(
AthleteId int,
ImagePath nvarchar(256)
)
That's a one-to-many relationship.
The column AtheleteId is the primary key of your Atheletes table (or something you identify your athletes with).
ImagePath will store the path of the image.
Make a foreign key constraint, linking the primary key of the Atheletes table with the column AthleteId of ProfileImages table.
Seems like this question is more about your schema design (nothing to do with .NET or C#.)
I am elaborating even further dude. Throw me a bone and mark it as Answer, if you found it useful lol.
Athelete: 21 @"C:\Users\Public\Pictures\Sample_Pictures\desert.jpg"
Athelete: 21 @"C:\Users\Public\Pictures\Sample_Pictures\sample.jpg"
Athelete: 22 @"C:\Users\Public\Pictures\Sample_Pictures\sample2.jpg"
so on.. where 21, 21, 22 are Ids of 2 atheletes. It can be any number, just think of a one-to-many mapping man..
Upvotes: 1