Hello am calling from a class to test my product however i keep getting this error: "Object reference not set to an instance of an object."
Testing:
global::OfficeSystem.Employees employees = new OfficeSystem.Employees();
employees.Delete(Convert.ToInt64("17")); <--- Primary Key
employees.GetEmployeeByOfficeID(Convert.ToInt64("6"));
What is the problem here?
This simply means you are using an object that is
null. Accessing a member onnullis never valid.I'm not sure which line is causing the error. Is it the one that says "Primary Key"? If so, could employees be
null? It should be extremely trivial to find out using the debugger.If needed, check for
nullbefore using the object to prevent this error.