1
我創建一個選美評分系統。插入函數:GenerateTransaction()
這是我的數據庫:
我的問題是,如何才能讓一個函數執行時,將根據加入交易表中的記錄,但保持得分空白或0參賽人數。
這是我有的功能,但立即關閉,並在交易表上不做任何事情。
Private Sub GenerateTransaction()
' load event of the logged in judge
JudgeTableAdapter.FillByJudge(Me.PSSdbDataSet.Judge, JudgeID)
JudgeBindingSource.DataSource = PSSdbDataSet.Judge
For Each drEventJudges As DataRow In Me.PSSdbDataSet.Judge.Rows
' load participants by event
ContestantTableAdapter.FillByContest(Me.PSSdbDataSet.Contestant, drEventJudges("Cont_id"))
CategoryTableAdapter.FillByContest(Me.PSSdbDataSet.Category, drEventJudges("Cont_id"))
' MessageBox.Show(Me.PSSdbDataSet.Category.Rows.Count.ToString, "Category Count")
For Each drCategory As DataRow In Me.PSSdbDataSet.Category.Rows
CriteriaTableAdapter.FillByCategory(Me.PSSdbDataSet.Criteria, drCategory("Cat_id"))
' MessageBox.Show(Me.PSSdbDataSet.Criteria.Rows.Count.ToString, "Criteria Count")
For Each drParticipant As DataRow In Me.PSSdbDataSet.Contestant.Rows
' MessageBox.Show(Me.PSSdbDataSet.Contestant.Rows.Count.ToString, "Participants Count")
For Each drCriteria As DataRow In Me.PSSdbDataSet.Criteria.Rows
TransactionTableAdapter.Insert(drEventJudges("Judge_id"), _
drParticipant("Cont_id"), _
drCriteria("Cri_id"), _
0)
Next
Next
Next
Next
End Sub