Hello.

I have two tables in a database - Clubs and Players. Each Club consists of 25 players. So a virtual table ClubsPlayers is created.

I would like to access this tables row or cell, but I don't know how.

As you can access real tables like this:

xDataSet.Clubs[1].IdClub;

Recommended Answers

All 7 Replies

You can do it by the club ID or the player ID (if it actually exists).

It exsists. Still not sure what you think..

What created the table?

When I included the database into my c# project, it automatically created the table in dataset. But I can't find it always, but only when clubsTableAdapter and playersTableAdapter are included on the same form. (sorry about not giving that info)

Ah, OK.
Now, I have to ask: Do you REALLY need to access it?

Also, if you know what name it will be when it is created, can you just create a Connection, Command, Reader, etc for it and only call it once it is created?

commented: Made me think a bit further :D +1

Oh shoot... Thank you! Player has the field with which it is connected with a club, so I can check the ID of it... Yea that's right!

But do you think it would be a problem to go through the whole database everytime I want to access a certain player of a certain club? (it has only 250 records)

Since the database is small, you can just load the entire thing into memory then search.
You can do a join on the tables and map them to a class in C# and just load it with one query.

Once it is memory, you can search it however you like without more database hits.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.