c# - Add recipe to database, how to? -


these our 3 tables. want new recipe tables. user gets screen can fill in recipename, method , can select 3 ingredients dropdown menu's. working asp.net in visual studio c#.

so when user fills in every field recipename , method added recipes table. ingredients belong recipe have added ingredientrecipe table.

how write query, because don't know recipeid since autoincrements?

recipes

recipeid     recipename                method 1            bacon , brocilli        bake bacon , cook brocolli 2            rice chicken         cook rice , bake chicken 4            potato , carrot         cook potatoes , carrots 6            rice chicken , carrot   cook 

ingredients

ingredientid     ingredientname       ingredientcategorie 2                bacon                3 3                brocolli             2 4                potato               1 5                chicken              3 6                carrot               2 7                rice                 1 

ingredientrecipe

recipeuniqueid   recipeid    ingredientid 1                   1         2 2                   1         3 3                   2         5 4                   2         7 5                   4         4 6                   4         6 7                   1         4 8                   2         6 9                   4         2 10                  6         7 11                  6         6 12                  5         5 

save recipe , ingredients first have valid id's save association.


Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -