473,385 Members | 1,655 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Please help with Dataset Problem

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.
Nov 19 '05 #1
3 1049
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

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Justin" <Ju****@discussions.microsoft.com> wrote in message
news:64**********************************@microsof t.com...
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.

Nov 19 '05 #2
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.
"Karl Seguin" wrote:
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

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Justin" <Ju****@discussions.microsoft.com> wrote in message
news:64**********************************@microsof t.com...
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.


Nov 19 '05 #3
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

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Justin" <Ju****@discussions.microsoft.com> wrote in message
news:4B**********************************@microsof t.com...
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.
"Karl Seguin" wrote:
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

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Justin" <Ju****@discussions.microsoft.com> wrote in message
news:64**********************************@microsof t.com...
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.


Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Steven | last post by:
Hi all My problem is a little lengthy. But please help me. In my application, ADO.NET DataSet object is not getting constructed in the Web Service Web Method called by the Windows Application...
6
by: Tiraman | last post by:
Hi , I have a stored procedure which return an xml by using the (for xml auto/explicit) which working fine under the Query Analyzer . and i would like to build simple function that get the sp...
0
by: Ammar | last post by:
Hi ... I have been reading throuhg the internet to solve a problem that happens to me when i try to access a databse in SQL mode... when i access the database through (visual web developer 2005)...
4
by: steroche | last post by:
I would REALLY appreciate help please please please! Im sure it is probably blindingly obvious to most of you but I am totally in the dark here!I am lost - i thought i had finally figured out this...
2
by: Calvin KD | last post by:
Hi everyone, I know the solution to my problem is probably very simple but I just can't seem to figure out how to do it. My problem is, I have an XML file as a datastore, I read it into a dataset...
7
by: Juan Romero | last post by:
Hey guys, please HELP I am going nuts with the datagrid control. I cannot get the damn control to refresh. I am using soap to get information from a web service. I have an XML writer output...
5
by: Darious Snell | last post by:
I am using windows forms and vb.net. My problem is a little complex so please bear with me. I have written an application that references a .com based API linked to an external client...
3
by: ricolee99 | last post by:
Hi everyone, I have a problem that i have been trying to solve for awhile. I'm given a code where the purpose is to create a general dataset mapper. Given any dataset, i have a class,...
5
by: AAJ | last post by:
Hi all FIRST THE BORING BITS....... I normally use a Database layer, a Business layer and a GUI layer. The GUI uses an Object data source to bind to the Business layer which in turn binds...
2
by: rocksoft | last post by:
Hi I am working in asp.net with C# web application, I have used visual studio 2003, i have used dropdownlist in my application to populate the data from mysql database, i have got problem while...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.