Please help with Dataset Problem

G

Guest

I am trying to do a simple update of a single row with the dataset below but
I keep getting this error:

"System.NullReferenceException: Object reference not set to an instance of
an object."

Here is the code:

Me.sqlDataAdapter1.Fill(DataSet1, "Queue")

Dim QueueRow As DataRow
QueueRow = DataSet1.Tables("Queue").Rows.Find(myCustomerID)
ERROR HERE< QueueRow(month) = ProductList.ToString()

Me.sqlDataAdapter1.Update(DataSet1, "Queue")

I have tried replacing all variables with strings with no luck

Please Help!

Thanks, Justin.
 
K

Karl Seguin

Justin:
Seems to me that your Find didn't find anything and thus QueueRow is
nothing...typically you check for nothing in this case:

if not QueueRow is nothing then
'get value
else
'throw an exception? use a default?
end if

Karl
 
G

Guest

Ok, with you help I think I have found the problem I just don't know how to
solve it.

I have set Rows.Find(myCustomerID) to Rows.Find("4") and it works fine but
as you know when I use a variable it does not work, I test to see if the
myCustomerID is empty by displaying it in a label control and it did so the
variable is not empty.

I am Lost.

THanks, Justin.
 
K

Karl Seguin

Justin:
Off the top of my head the only thing I can think of is that there's some
weird type mismatch going on. is myCustomerID an integer or a string? By
the name i'd assume it was an integer, but it seemed to have worked when you
used a string "4" if it is an integer does it work when you ToString()
it...or does Rows.Find(4) work ?

Karl
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,710
Latest member
bernietqt

Latest Threads

Top