473,395 Members | 1,404 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,395 software developers and data experts.

strange object reference error

..net 2.0 -

I've been getting a very strange error on my websites I can't track
down. It only happens occasionally, and continues until IIS is reset.

The error happens on line 10: Dim product As Product =
LoadProduct(row.Row)
It looks like row.Row is not being found in the view

We're caching the data - could this be related to the cache being
released and not fully repopulating itself? The code for
GetAllProductsDataSet() is the second set of code. Are there any
obvious errors, or a better way to handle it? Thanks

Error received: Object reference not set to an instance of an object.

This is the code the error happens on (line 10):
1 Dim ds As DataSet = GetAllProductsDataSet()
2 Dim products As New List(Of Product)
3 Dim myView As DataView
4 myView = ds.Tables(0).DefaultView
5 myView.Sort = sort
6 If Not "".Equals(filter) Then
7 myView.RowFilter = filter
8 End If
9 For Each row As DataRowView In myView
10 Dim product As Product = LoadProduct(row.Row)
11 If Not product Is Nothing AndAlso Not
products.Contains(product) Then
12 products.Add(product)
13 End If
14Next

GetAllProductsDataSet()
1 Dim cacheKey As String = "AllProducts-DataSet"
2 Dim ds As New DataSet()
3 ds = CType(Item(cacheKey), DataSet)
4 If ds Is Nothing Then
5 Dim ds2 As New DataSet
6 Using conn As SqlConnection = GetConnection(connstring)
7 Dim cmd As SqlCommand = New SqlCommand(storeproc, conn)
8 cmd.CommandType = CommandType.StoredProcedure
9
10 Dim da As New SqlDataAdapter(cmd)
11
12 Try
13 conn.Open()
14 da.Fill(ds2, "AllProducts")
15 Catch ex As Exception
16 Throw ex
17 Finally
18 If Not conn Is Nothing Then
19 conn.Close()
20 End If
21 End Try
22 End Using
23 ds = ds2
24 AddToCache(cacheKey, ds,
System.Web.Caching.CacheItemPriority.NotRemovable, 300)
25 End If
26 Return ds
thanks - Susan

Dec 18 '06 #1
0 853

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

Similar topics

0
by: James Sleeman | last post by:
Hi all, i just spent an hour rifling through code to find the cause of a problem only to find it's an oddity with serialization and recursive objects, so figured I'd post for the next person who...
13
by: Neil Zanella | last post by:
Hello, I wonder whether anyone has ever come across the following g++ compiler error message. I don't recall ever seeing it before. I solved my problem but I am still not sure about what this...
2
by: Olaf | last post by:
I have a frameset page witch contains the myFuc() function. The function is accessed from a page in one of the frames in the frameset. An example is shown below. <input...
8
by: grundmann | last post by:
Hello, i got a strange compiler error. When compiling the following: // forward declarations typedef AvlTree<LineSegment,LineSegmentComperator> LSTree; void handleEventPoint (const...
2
by: TB | last post by:
I am seeing a very strange problem as follows... I have a loop where a fair amount of processing is going on and near the top of the loop I access a class that has only static helper functions...
6
by: Tamir Khason | last post by:
I recieve the very strange error while compiling project: "object reference net set to the instance of the object" in line 0 !!! The first lines in this .cs are using System; using...
1
by: Chris Magoun | last post by:
I suddenly received an unexpected error in my project. I have been working on this project for some time without this issue. Nothing has changed in the form that caused the exception. A little...
1
by: pitjpz | last post by:
We have moved our Database to another server. The server it was on used SQL 4 and the new one its on now uses SQL5 the only problem we can find is that when you attempt to delete a record from...
4
by: John Brock | last post by:
I have a .NET application that, among other things, creates Excel workbooks, and I have run into a very strange problem involving formulas on one worksheet that reference values on another...
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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.