Click here to Skip to main content
15,881,967 members
Please Sign up or sign in to vote.
2.33/5 (2 votes)
To explain myself:

tables:

http://i.stack.imgur.com/fsT5R.png

Album holds information about albums, Album_Artiest is a junction table and Artiest holds the Artists name.

I already made a form in C# to add Artists. Now i need a form to add Albums. I use the dataset and tableadapter wizard and then drag and drop from datasource on the form to generate the form. Now my problem:

I need to have all the columns from album but only the ArtiestNaam from Artiest. And this in a combobox so i can select an artist from that table.

When i save it it should connect that AlbumId to that specific ArtiestId in the junction table.

I did some research and i found that i should use stored procedures. Could somebody help me?
Posted
Updated 3-Feb-14 23:48pm
v5

1 solution

You want to fill the DropDown for the Artiest from the Artiest DataTable. To Do so set the Artist DataTable as DataSource to the DropDown.
To Save the data you have to insert them into the mapping table (Album_Artiest) to do so you can either use plain sql statements or create a tableadapter/dataset similar to artist with the table wizzard you've used before. Then insert the data in the datatable and save it. It should be synced to db then.
 
Share this answer
 
Comments
Member 7911149 4-Feb-14 9:03am    
The datasource for the dropdown menu works. But the problem is that visual studio doesnt understand that i want a windows form with text boxes and a combobox from different tables. If i add an album i want to be able to select an artist from the artist table and the program should make an entry in album table to save all the album data and then in the album_Artist table it should make an entry with the album id i just created and the artist id i selected from the combobox.
Member 7911149 4-Feb-14 9:03am    
Btw, I do have it working somewhat. Only now the problem is that i cant save it to the database because the save button is greyed out.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900