我有這樣的代碼:C# - 添加新的行數據集
DataRow myNewRow;
myNewRow = hRAddNewDataSet.Vication.NewRow();
myNewRow["EmployeeID"] = Convert.ToInt32(employeeIDTextBox.Text);
myNewRow["VicationDate"] = vicationDateDateTimePicker.Value;
myNewRow["VicationSubject"] = vicationSubjectTextBox.Text;
myNewRow["VicationType"] = Convert.ToInt32(vicationTypeComboBox.SelectedValue);
myNewRow["Time"] = Convert.ToInt32(timeTextBox.Text);
myNewRow["VicationAs"] = Convert.ToInt32(vicationAsComboBox.SelectedValue);
myNewRow["StatementNo"] = statementNoTextBox.Text;
myNewRow["StatementDate"] = statementDateDateTimePicker.Value;
myNewRow["Info"] = infoTextBox.Text;
hRAddNewDataSet.Vication.Rows.Add(myNewRow);
當我運行此代碼,這將增加新行,因爲我想要的,但它也將更新當前行取決於
值vicationBindingSource.Position
我該如何解決這個問題?
可能要重構'vication'到'vacation' – briantyler 2011-04-24 09:31:18
@B泰勒:爲什麼我做對子級那?? – Saleh 2011-04-24 09:33:10
「更新當前行」是什麼意思?將另一行設置爲當前?更新當前行中的值? – DarkSquirrel42 2011-04-24 09:42:32