Tutorial on many-to-many relations DB in VB.net
Do you need something made? then ask in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Hey there....
ok .. i give up
well.. not quite, but i am trying to wrap my head around using databases in VB.net .. and i know how to instansiate a DB .. make it a part of the project... i know how to make tables.... i even know how to make relations between tables .. BUT .... i cant figure out "many-to-many" relations and how to dislay this on forms
i know that you need 3 tables for this .. and you need the two original tables, and they need have a primary key .. and the joining table (in the middle, in terms of relations) has to have its own primary key AND the foreign key of the other two tables.. so fare soo good
I am trying to make a training program simular to the illustrations i made for this question (this is not a actual database i have yet.... illustrations is just made in photoshop)
.... so i got the database schematics pinned down i think ..
But i cant figure out how to make VB.net do this :
1. on the "individual training log" form show all training sessions the person has ever attended (ex. John) .. including the specific equipment he used for each individual training session
2. on the "training session" form show all available persons from "individual training log" in ex. a listbox
3. and when their name is dragged onto the picked training equipment for the day .. save that information into the gridview below .. which then again will be reflected back to the"individual training log" form - so that the individual person can see which equipment he used at each training session
so basically what im asking for, is a tutorial on, "many to many relational DB'ing in vb.net ... including the tricky part ... pulling information from the different database tables (see attachment) .. and displaying it on forms"
it is NOT important to include all the "person details" for each individual in the tutorial .. the important stuff is to show how to make the relations work .. and display of data related to these relations
if anyone would find it interessting to make such a tutorial .. i am eternally greatfull .. and im sure im not the only one struggling with "many to many " relations :-)
Thank you for the time you spend reading this
Im new at this .. but i find it soo interresting that sometimes i even dream in code
New Guy :-)
ok .. i give up

i know that you need 3 tables for this .. and you need the two original tables, and they need have a primary key .. and the joining table (in the middle, in terms of relations) has to have its own primary key AND the foreign key of the other two tables.. so fare soo good
I am trying to make a training program simular to the illustrations i made for this question (this is not a actual database i have yet.... illustrations is just made in photoshop)

.... so i got the database schematics pinned down i think ..
But i cant figure out how to make VB.net do this :
1. on the "individual training log" form show all training sessions the person has ever attended (ex. John) .. including the specific equipment he used for each individual training session
2. on the "training session" form show all available persons from "individual training log" in ex. a listbox
3. and when their name is dragged onto the picked training equipment for the day .. save that information into the gridview below .. which then again will be reflected back to the"individual training log" form - so that the individual person can see which equipment he used at each training session
so basically what im asking for, is a tutorial on, "many to many relational DB'ing in vb.net ... including the tricky part ... pulling information from the different database tables (see attachment) .. and displaying it on forms"
it is NOT important to include all the "person details" for each individual in the tutorial .. the important stuff is to show how to make the relations work .. and display of data related to these relations
if anyone would find it interessting to make such a tutorial .. i am eternally greatfull .. and im sure im not the only one struggling with "many to many " relations :-)
Thank you for the time you spend reading this
Im new at this .. but i find it soo interresting that sometimes i even dream in code

New Guy :-)
You do not have the required permissions to view the files attached to this post.
Ask Dummy, he knows alot about databases
Edit: Yes, I meant Dummy1912
Edit: Yes, I meant Dummy1912
Last edited by MrAksel on Thu Jun 16, 2011 10:31 am, edited 1 time in total.
LMAOSHMSFOAIDMT
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;
Over 30 projects with source code!
Please give reputation to helpful members!
![Image]()
![Image]()
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;
Over 30 projects with source code!
Please give reputation to helpful members!

MrAksel wrote:Ask Dummy, he knows alot about databases
Hi MrAksel
did you mean "Dummy1912" ?

omg;
Does anybody call my name? hehaho;
Hi Newguy,
Whats wrong...
did you download my tutorials about databases?
maybe that can help you out a little.
Dummy1912
Does anybody call my name? hehaho;
Hi Newguy,
Whats wrong...
did you download my tutorials about databases?
maybe that can help you out a little.
Dummy1912
visit us on:
http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
Dummy1912 wrote:omg;Hi Dummy1912 .. thanks for answering me
Does anybody call my name? hehaho;
Hi Newguy,
Whats wrong...
did you download my tutorials about databases?
maybe that can help you out a little.
Dummy1912
i dont use Access databases .. but i make the database through VB.net ... and want to learn to use the the "table adapter" - "Binding source" and dataset tools which VB.net provides .... and at the same time im trying to figure out how to do the 3 things i listed above .. can you help ? .. maybe even make s small example of how to do it ?

New Guy
Hi New Guy,
Hmmm to be honest i have always work with a .mdb database
But ill try to find my old project i created before i learned about .mdb
i don't promise anything.
Dummy1912
Hmmm to be honest i have always work with a .mdb database
But ill try to find my old project i created before i learned about .mdb

i don't promise anything.
Dummy1912
visit us on:
http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
Hi New Guy,
Well i have found a old one
i ever made in vb 2003 yea old :p
Okay to be sure this is what you want i add a small Picture so tell me thats what you want.
Dummy1912
Well i have found a old one

i ever made in vb 2003 yea old :p
Okay to be sure this is what you want i add a small Picture so tell me thats what you want.
Dummy1912
You do not have the required permissions to view the files attached to this post.
visit us on:
http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
Hi Dummy1912,
thank you for your answer ... but thats not quite what i had in mind
see .. you use only 2 tables .... and i think thats not enough .. since its a many-to-many reation .. i think 3 is needed
- many people can participate in one training session
- one person may have participated in many training sessions
i have now made the DB in vb.net ... and have a working DB .. and i made a picture of how i am doing the relations (see attachment : DatabaseAndRelations.jpg)
but this picture doesnt show where the relations are going ... so i made a picture of that too ... the 2 pics are identical .. just the one shows better the relationships in the DB
i just dont know how to get the DB/tables showing up on forms from the different relations
thank you for your answer ... but thats not quite what i had in mind

see .. you use only 2 tables .... and i think thats not enough .. since its a many-to-many reation .. i think 3 is needed
- many people can participate in one training session
- one person may have participated in many training sessions
i have now made the DB in vb.net ... and have a working DB .. and i made a picture of how i am doing the relations (see attachment : DatabaseAndRelations.jpg)
but this picture doesnt show where the relations are going ... so i made a picture of that too ... the 2 pics are identical .. just the one shows better the relationships in the DB
i just dont know how to get the DB/tables showing up on forms from the different relations
You do not have the required permissions to view the files attached to this post.
Hi New Guy,
blusho; mine was only a example you know
how many tables you want thats up to you ;)
and i don't know if you made a connection already on your form?
if you have you can use this to load the database.
you will see right the Properties
go there and look for : DataMember
add there the Agent or whatever you need from a table.
then DataSource add there : Ds1
Good Luck
if you still can't find it or still have trouble
maybe i need to pm you my example :(
Dummy1912
blusho; mine was only a example you know

how many tables you want thats up to you ;)
and i don't know if you made a connection already on your form?
if you have you can use this to load the database.
Code: Select all
if you use a datagrid you must configurate it first'this will come in the form_load
DA.Fill(Ds1, "Agent")
'DA = a OleDbDataAdapter what name you want :D i call my DA
'Ds1 = a Public Class you will see this when you made your database i hope
'Agent is the table from the database
you will see right the Properties
go there and look for : DataMember
add there the Agent or whatever you need from a table.
then DataSource add there : Ds1
Good Luck
if you still can't find it or still have trouble
maybe i need to pm you my example :(
Dummy1912
visit us on:
http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
Hi Dummy1912 .. i have made the DB connection already, that works fine
but i cant figure out how to populate the gridview with the correct data
Maybe it would be a good idea if i saw your DB example .. you are welcome to PM me
NewGuy
but i cant figure out how to populate the gridview with the correct data
Maybe it would be a good idea if i saw your DB example .. you are welcome to PM me

NewGuy
Copyright Information
Copyright © Codenstuff.com 2020 - 2023