User753101303 postedHi,
For now the code doesn't show how obj is declared or initialized? It's likely best to start by looking at which error message your have rather than to guess from the code.
Do you have a compile time error or a NullReferenceException ?
Edit: in short it seems that obj is not declared or if declared not initialized to a non null value. Could be still any other issue (a wrong connection to the db etc..). The purpose of errror messages is to tell you which bad thing happens and ti would be best to always start from the error message.