I have MySql for users, I need to make a list of links for them, each user has his own. I also have an Account class, and Links in it; And so

 Links[] l = new Links[6]; 

It is necessary to stuff in MySql into one field of links in the login line, so that they are there, and in the program are decrypted normally.

It is desirable without unnecessary files in the program folder.

  • To do this, you need to make a separate table, rather than stuff it in 1 field and then decrypt it - Zergatul
  • @Zergatul It turns out under 15000 users to do 15000 tables? - Arasfon
  • The table is one. And in each record - the user ID and one of its links. - Akina
  • @Akina Each user has his own number of links, one has a maximum of 10, the other has 50 ... The number always varies, like friends on Steam. You need a list like friends on Steam. - Arasfon
  • @Osid read the basics of the database, what is the foreign key - Zergatul

1 answer 1

If you want to keep one field in the database, you can write links to the database through ";" or "\ n", and then in the main program do so

 string linksInDb = "взять; из; базы;"; List<string> links = linksInDb.Split(';').ToListArray(); 

But the correct option will be stored in the database in a separate table like this:

 UserId Link id ссылка id ссылка ... ... 

Links can also be stored in a separate table, and substitute only an ID, which will allow you not to write links several times, but simply use the Id of the desired link.