私はすでにIDENTITY
データベースを yes に設定しており、アプリケーションを実行するたびにキーが自動インクリメントされず、null 値が許可されないというエラーが表示されます
private void button8_Click(object sender, EventArgs e)
{
string fname = textBox1.Text;
string lname = textBox2.Text;
//int idnum = Convert.To(textBox3.Text);
int mobnum = Convert.ToInt32(maskedTextBox1.Text);
string email = textBox4.Text;
int EdInst = comboBox1.SelectedIndex+1;
string EdLev = comboBox3.SelectedText;
string EdName = comboBox2.SelectedText;
Boolean Valid = true;
Valid = Validation(Valid);
if (Valid == true)
{
IS2Team1_TriplexDBDataSet.ApplicantRow NewApplicantRow = iS2Team1_TriplexDBDataSet1.Applicant.NewApplicantRow();
IS2Team1_TriplexDBDataSet.ApplicationRow NewApplicationRow = iS2Team1_TriplexDBDataSet1.Application.NewApplicationRow();
//NewApplicantRow.Applicant_ID = ??; // What do i do here for the ID to auto increment?
NewApplicantRow.First_Name = fname;
NewApplicantRow.Last_Name = lname;
//NewApplicantRow.ID_Number =Convert.ToInt32(textBox3.Text);
NewApplicantRow.Contact_Number = mobnum;
NewApplicantRow.Email_Address = email;
NewApplicantRow.University_ID = EdInst;
//NewApplicationRow.Application_ID = ??; // What do i do here for the ID to auto increment?
NewApplicationRow.Application_Status = "Recieved";
NewApplicationRow.Application_Date = DateTime.Today;
iS2Team1_TriplexDBDataSet1.Applicant.Rows.Add(NewApplicantRow);
iS2Team1_TriplexDBDataSet1.Application.Rows.Add(NewApplicationRow);
MessageBox.Show("Application Submitted", "Application Submitted");
this.applicantTableAdapter.Update(this.iS2Team1_TriplexDBDataSet1);
//Hide();
//Form4 frmUpdate = new Form4();
//frmUpdate.Show();
}
else if (Valid == false)
{
MessageBox.Show("Required Information Missing");
textBox1.Focus();
}