public string InsertEmployee(Employee ObjEmployee)
{
string msg = String.Empty;
int noOfRowEffected = 0;
try
{
if (sqlConn.State == ConnectionState.Closed)
sqlConn.Open();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "INSERT INTO Employee(Name , Designation , BloodGroup)"
+ " VALUES('" + ObjEmployee.Name + "','" + ObjEmployee.Designation + "','" + ObjEmployee.BloodGroup + "')";
noOfRowEffected = cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
}
catch (Exception exp)
{
throw (exp);
}
finally
{
if (sqlConn.State == ConnectionState.Open)
sqlConn.Close();
}
if (noOfRowEffected > 0)
return "Employee information saved successfully!";
else
return msg;
}