Anna Hawks

Anna Hawks

  • NA
  • 243
  • 0

Object reference not set to an instance of an object.

Jan 15 2008 5:36 PM

I'm sure I'm just tired and will feel really stupid when I find out the answer, but I have a Web Page that when it tries to set Insert Parameters gives me a NullReferenceException (see subject)

The specific method is :

protected void frmChgRequest_Inserting(object sender, FormViewInsertEventArgs e) {

SqlChgRequest.InsertParameters["ChgID"].DefaultValue = chgIDComplete.ToString();

SqlChgRequest.InsertParameters["RequestDate"].DefaultValue = DateTime.Now.ToString();

}

The error occurs on the first InsertParameters statement. The obvious answer is that the stringbuilder "chgIDComplete" is null, but on debug, it shows a value of "MERCHANT2008115HW". A stringbuilder should have no problem converting to a string. What am I doing wrong?


Answers (5)