Note that there are some explanatory texts on larger screens.

plurals
  1. POAccessing many table's data through only one table (C# + SQL Server)
    primarykey
    data
    text
    <p>By the few months I was trying to do an application using Sql Server + C#. The program is a kind of "Pokémon Agenda", where a user can add and edit pokémons and their abilities, types and photo, besides other functions like searching for records. Here's a print screen from the Form and from the tables diagram:</p> <p><img src="https://i.stack.imgur.com/zU2YE.jpg" alt="enter image description here"></p> <p><img src="https://i.stack.imgur.com/TCld6.jpg" alt="enter image description here"></p> <p>Here's my problem: I was trying to access directly the names from the tables "Abilities" and "Types" by only using its ID's (AbilityID and TypeID) from the table "Kanto". In other words, I was trying to <strong>access many data from different tables using</strong>, basically, <strong>just one table!</strong> However, I am not sure if this is exactly possible. I thought in 2 possibilities:</p> <ol> <li><p>Using <strong>Dataset relations</strong> (although this solution is not too clear for me yet), for example:</p> <p>ds.Relations.Add("PokéAbility", ds.Tables["Abilities"].Columns["AbilityID"], ds.Tables["Kanto"].Columns["AbilityID"]);</p></li> <li><p>Using a <strong>Natural Join</strong>, so I could create more tables and use them too to manipulate my desired data. </p></li> </ol> <p>Note: the tables "Types" and "Abilities" should be already filled with all the necessary information, so they won't be edited during the execution of the Form.</p> <p>I won't paste the whole code because it is a little long, but, if you would like to see a specific part of it, just ask me that I will provide it.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload