我有一个getter和setter类,我已经将值设置为myForm但是当我尝试在另一个类中使用它时,我创建了类getter和setter的新对象,并且数据正在被淘汰,因为我使用了new关键字,所以是他们使用其设定值访问我的obj的任何其他方式。
**Projects delp= new Projects(**);//------->here i used new keyword.
public void DeleteEmployee()
{
sqlcommand = new SqlCommand("insert into Del_Employy_rec values ("+delp.Empid
+","+delp.Empname+","+delp.Empaddress+","+delp.contactno+","+delp.Empdoj+","+delp.EmpPrjal
lot+","+delp.Empcategory+")", sqlconnection);
sqlcommand.ExecuteNonQuery();
sqlcommand = new SqlCommand("delete from Employee where emp_id=" + delp.Empid, sqlconnection);
sqlcommand.ExecuteNonQuery();
}
Thanks in advance