ambigous: "System.NullReferenceException: Object reference not set to an
instance of an object." I have tried replacing the variable "month" with a
string and I tried replacing "ProductList.ToString()" with a string but I
still get the error:
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")
Please Help!
Thanks, Justin.Justin wrote:
> (abridged) I have tried replacing the variable "month" with a
> string and I tried replacing "ProductList.ToString()" with a string but I
> still get the error:
What is the value of the month variable? It looks as if you're trying to
change the value of the "month" column in the DataRow. If so you must
place quotes around the word "month". Like this:
QueueRow("month") = ProductList.ToString()
Anders Nor?s
http://dotnetjunkies.com/weblog/anoras
month is a string variable representing a table column to save the data to, I
have tried replacing this with a static column string but I still get the
same error.
"Anders Nor?s" wrote:
> Justin wrote:
> > (abridged) I have tried replacing the variable "month" with a
> > string and I tried replacing "ProductList.ToString()" with a string but I
> > still get the error:
> What is the value of the month variable? It looks as if you're trying to
> change the value of the "month" column in the DataRow. If so you must
> place quotes around the word "month". Like this:
> QueueRow("month") = ProductList.ToString()
> Anders Nor?s
> http://dotnetjunkies.com/weblog/anoras
Justin wrote:
> month is a string variable representing a table column to save the data to, I
> have tried replacing this with a static column string but I still get the
> same error.
Ok, then I suspect that the statement
DataSet1.Tables("Queue").Rows.Find(myCustomerID) evaluates to null. If
this is the case, the ensuing statement will cause an
NullReferenceException. You can place an assertion in your code to
display a message if the QueueRow is null.
The following statement check whether QueueRow is null and outputs a
message if it is:
Debug.Assert( Not (QueueRow Is Nothing), "QueueRow parameter is null",
"Can't get object for null type")
Anders Nor?s
http://dotnetjunkies.com/weblog/anoras/
0 comments:
Post a Comment