Thursday, March 22, 2012

Object reference not set to an instance of an object.

Hi

I am getting an 'System.NullReferenceException: Object reference not set to
an instance of an object.' error on the following line;

Dim sSQL As String = "INSERT INTO applications ( title, forenames, surname,
occupation) " & _ '<== This line gives the error.
"VALUES('" & txtTitle.Text & "', '" &
txtForenames.Text & "', '" & txtSurname.Text & "', '" &
txtOccupation.SelectedItem.Text & "')"

What am I doing wrong?

Thanks

Regardshi john,
The line of code that you gave below might not throw this exception. If you
can paste a few lines below and after it would be much clear.
the best
srini

"John" wrote:

> Hi
> I am getting an 'System.NullReferenceException: Object reference not set to
> an instance of an object.' error on the following line;
> Dim sSQL As String = "INSERT INTO applications ( title, forenames, surname,
> occupation) " & _ '<== This line gives the error.
> "VALUES('" & txtTitle.Text & "', '" &
> txtForenames.Text & "', '" & txtSurname.Text & "', '" &
> txtOccupation.SelectedItem.Text & "')"
> What am I doing wrong?
> Thanks
> Regards
>

0 comments:

Post a Comment