Still working out a few bugs in a survey program I'm writing. The way I
have it configured is as each survey is completed, the dataset is updated.
When the program is closed, the database itself is updated. However, when I
check the database table, there are some answers that are duplicated two and
three times.
Here are some snippets...
//This sub is called on the last page of the survey when the "Finish" button
is clicked.
Sub GatherAndUpdateAnswers()
//there is some code before this that gathers all the answers and assigns
them to variables
dim newrecord as datarow = mainform.dssurveydata1.survey_data.newrow
newrecord(0) = QuestionOneAnswer
newrecord(2) = QuestionTwoAnswer
//repeats like this until twelve
mainform.dssurveydata1.survey_data.rows.add(newrec ord)
end sub
Sub UpdateData()
dim pdsInsertedRows as system.data.dataset
pdsInsertedRows = mainform.dssurvey_data1.getchanges(datarowstate.ad ded)
mainform.oledbdataadapter1.update(pdsInsertedRows)
end sub
Private Sub Form1_Closing(...)
Call UpdateData()
end sub
When the "Finish" button is clicked on the last form,
GatherAndUpdateAnswers() is called.