private void updateAge(string std_Birthday, string std_ID) { calculateAge calculateAge = new calculateAge(); var Age = calculateAge.calAge(Convert.ToDateTime(std_Birthday)); database.strSQL = "UPDATE tblStudent SET " + " std_AgeY=" + Age.Year + ", " + " std_AgeM=" + Age.Month + " WHERE std_ID=" + std_ID; database.DoSQL(database.strSQL); }
private void btnCalAge_Click(object sender, EventArgs e) { DialogResult Result = MessageBoxAdv.Show("�س�������ѹ���Ѩ�غѹ�ͧ����������ͧ�س�١��ͧ������������� ?", "��ѹ��õ�Ǩ�ͺ�ѹ���", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (Result == DialogResult.Yes) { calculateAge calculateAge = new calculateAge(); var Age = calculateAge.calAge(dtpBirthday.Value); txtStdAgeY.Text = Age.Year.ToString(); txtStdAgeM.Text = Age.Month.ToString(); database.strSQL = "UPDATE tblStudent SET " + " std_AgeY=" + txtStdAgeY.Text + ", " + " std_AgeM=" + txtStdAgeM.Text + " WHERE std_ID=" + txtStdID.Text; database.DoSQL(database.strSQL); } }