I've got VS C# express and SQL express connected and running fine, as far as I can tell. I can add and edit tables in VS, etc. I'm new to SQL though, so I wanted to ask a few questions that might be easy to answer. I'm working on a little Windows application that allows users to create and test themselves with flash cards.
Here's how the program is supposed to work: A user selects a card through a ListBox in the UI, and then the contents of the card are displayed. (This works fine.) Depending on whether the user remembered the card correctly, he clicks on the "right" or "wrong" button. Then the next card comes up and the process repeats.
I created two SQL tables to manage the information. One stores all the flash cards, with titles, contents, pictures, etc. The other stores the user's history: which cards came up, at what time, and whether the user got the card wrong or right. Do you think that this data organization makes sense
Assuming it does make sense, I'm trying to figure out how to add a new row to the history table every time the user presses the "right" or "wrong" button. The columns of the History table are HistoryID (primary key), CardID (foreign key that connects it to another table), timestamp, and Score (an int).
Now, when the user clicks "wrong," here's the event handler code I wrote:
flashcardDataSet.HistoryRow historyitem = flashcardDataSet.History.NewHistoryRow();
historyitem.CardID = 1; // I want to connect this to the CardID of the current card, but // not yet sure how to do this!!)
historyitem.Score = 1; // 1 is the score for Wrong
flashcardDataSet.History.AddHistoryRow(historyitem);
historyTableAdapter.Update(historyitem);
This compiles, but when I click the button in debugging, the SQL row isn't added. Any idea about what I'm missing
Thanks a bunch. I'm obviously a beginner with this stuff.
-Mickey