Bilawal Niaz

Bilawal Niaz

  • NA
  • 110
  • 16.6k

On C# Viual Studio

Jun 27 2015 9:21 AM
I DEVELOP A SOFTWARE ON VISUAL STUDIO (C #) "EMPLOYEE INFROMATION SYSTEM",
 
 WHEN I ENTERED A RECORD IN SOFTWARE, IT ADDED,
 
BUT WHEN I ADDED A RECORD HAVING EMPTY FIELDS
IT SHOWS RECORD DOES NOT ADDED BECAUSE FIELDS ARE EMPTY,
 
BUT IN DATA BASE RECORD WILL SAVE HAVING EMPTY FIELDS, WHY? 
ANY BUDY HELP ME...! 
 
THE CODE IS THAT: 
 
==> 
private void button1_Click(object sender, EventArgs e)
{
try
{
Department obj = new Department();
obj.DeptName = textBox1.Text;
obj.Description = textBox2.Text;
DepartmentDAL obj2 = new DepartmentDAL();
obj2.addDepartment(obj);
if (textBox1.Text != "" && textBox2.Text != "")
{
MessageBox.Show("Record Saved Successfully !", "Employee Information System");
clear();
}
else { MessageBox.Show("Error : Field's Empty \n\nEnter The Record To Save !", "Employee Information System"); }
}
catch { MessageBox.Show("Error : Field's Empty \n\nEnter The Record To Save !", "Employee Information System"); }
}
 

Answers (4)