C
C#16mo ago
adoma

✅ Asp.Net Help

I'm working on a assignment and really need some help. We have to make a website where we can show high scores on 4 different games. I have 2 tables (games and Scores) with a one to many relation between them, where one game can have many scores. On the submit new high score page I have 4 input fields, the first one is a dropdown where I generated the game.titles from games table. My problem is when I try to submit the gameId always stays on 0.
28 Replies
Preda
Preda16mo ago
Do you have a ParentID in your Game class (business layer)
adoma
adoma16mo ago
i have the id property
Preda
Preda16mo ago
I think you are using Agregation and Composition A player has a game and that game has more scores Your problem could be in the Business/Persistence layer since your ID isn t updating Have you tried unit testing your business layer?
adoma
adoma16mo ago
No i haven't, pretty new to this 😛
Preda
Preda16mo ago
You can t be that new if you re working with Composition + Agregation So
adoma
adoma16mo ago
im not sure if there is a problem with the html ive written
Preda
Preda16mo ago
Most probably with the back end Show your aspx page
adoma
adoma16mo ago
i will show the exception
Preda
Preda16mo ago
K
adoma
adoma16mo ago
SqlException: The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Scores_Games_GameId". The conflict occurred in database "Highscore", table "dbo.Games", column 'Id'. how i understand this is that the id for the game i choose is 1 and the gameId it's setting is 0
Preda
Preda16mo ago
Can you show the database? Your dbo.games table
adoma
adoma16mo ago
yea sure give me a sec
adoma
adoma16mo ago
Preda
Preda16mo ago
Can you provide a screenshot of all classes in your project?
adoma
adoma16mo ago
adoma
adoma16mo ago
adoma
adoma16mo ago
this is the html form
Preda
Preda16mo ago
All the way on the right side You have your project explorer
adoma
adoma16mo ago
don't see it 😛
Preda
Preda16mo ago
Can you show your full VS window?
adoma
adoma16mo ago
misunderstood what u meant, mb
Preda
Preda16mo ago
Oh fck I wasn t expeting this type of building the website
adoma
adoma16mo ago
what u mean m8? hahaha
Preda
Preda16mo ago
I never have worked this way
adoma
adoma16mo ago
it's Asp.net core MVC
Kouhai
Kouhai16mo ago
what problem are you facing? @adoma
adoma
adoma16mo ago
Took me time but i fixed the issue. Thanks for the assistance tho 🙂
Accord
Accord16mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server
More Posts