Serenity
Serenity

Reputation: 5098

Error ::Object reference not set to an instance of an object

What could be wrong ?

public int InsertUpdateQues(bllQues objbllQues)
    {


        dsgetQues = objdllQues.InsertUpdateQues(this);  //ERROR here
        return dsgetQues;
    }

I see values getting assigned to ALL the above properties, not one is missing. Whats wrong then?

EDIT I found the error..In my dllQue class's insert update method I had two entries as sqlParam[4] =new... and sqlParam[4] =new...chnaged the 2nd one to 5.. damn..the problem is I KEEP on making silly mistakes! :( How can I avoid this so my time is not wasted this way ???

Upvotes: 0

Views: 178

Answers (1)

Beth Lang
Beth Lang

Reputation: 1905

It might help to use constants for your indexes so that your code would look something like sqlParam[CustomerName] = ... That would help readability a little and you might catch your mistakes faster.

Upvotes: 1

Related Questions