Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a code that can add and update record into database.All the database and code had been done but there is a problem is i need to assign the
C#
row.gen_modifyUser = SYSTEM_USER_LOGIN.UserName;
row.gen_entryUser = SYSTEM_USER_LOGIN.UserName;
in business Logic layer with the code become not null.
Here is my business logic code:
C#
public static bool TMS_GET_PROXIMITY_VALID_TO_USE(string s_proximityNumber)
        {
            bool b_valid = true;
            using (TMPB_attn_DAL dalTMPB_attn = new TMPB_attn_DAL())
            {
               dalTMPB_attn.SetNewCriteria("gen_modifyUser", s_proximityNumber != null);
               dalTMPB_attn.SetNewCriteria("gen_entryUser", s_proximityNumber != null);
               return b_valid;
            }
        }

I had set the gen_modifyUser and gen_entryUser equal to not null but it doesn't work!!!It will pop out the error object reference not set to an instance of an object
can anyone help me figure out where i had done wrong?
Posted

1 solution

So use the debugger.
Run your code in the debugger, and either wait until the exception happens - in which case the debugger will stop on the line causing the problem - or put a breakpoint at teh top of the relevant method and wait until the debugger hits it.

In either case, you can then examine your variables to find out which one is null and causing the problem (any attempt to access a property, field or method of a null value will give you this exception) and then look back through you code to work out why is does not have a valid value.

We can't do that for you: Remember that we can't see your screen, access your HDD, or read your mind, so we can;t run your code and find out what the problem is!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900