G
Guest
I have a funtion that works fine and dandy when called from anywhere in my
app. It will NOT work when called from inside the class in which it resides.
This is the function I'm calling: "getProductByID(productID)" from inside
another method in the same class. See below.
This line throws a null ref exception:
While dr.Read()
Thanks for any insight!
Public Sub deleteProduct(ByVal productID)
'Set up parameters
Dim arParms(0) As SqlParameter
arParms(0) = New SqlParameter("@productID",
SqlDbType.UniqueIdentifier)
arParms(0).Value = productID
'get the images to delete
Dim context As System.Web.HttpContext = System.Web.HttpContext.Current
Dim dr As SqlDataReader = getProductByID(productID)
Dim thumbImg As String
Dim fullImg As String
While dr.Read()
'delete thumb
fullImg = context.Application("webRoot") &
"vendorImages/" & dr.Item("galleryFolder").ToString & "/" &
dr.Item("imageFull").ToString
fullImg = context.Current.Server.MapPath(fullImg)
Dim thisImgFull As New System.IO.FileInfo(fullImg)
thisImgFull.Delete()
End While
.... omitted for brevity
End Sub
app. It will NOT work when called from inside the class in which it resides.
This is the function I'm calling: "getProductByID(productID)" from inside
another method in the same class. See below.
This line throws a null ref exception:
While dr.Read()
Thanks for any insight!
Public Sub deleteProduct(ByVal productID)
'Set up parameters
Dim arParms(0) As SqlParameter
arParms(0) = New SqlParameter("@productID",
SqlDbType.UniqueIdentifier)
arParms(0).Value = productID
'get the images to delete
Dim context As System.Web.HttpContext = System.Web.HttpContext.Current
Dim dr As SqlDataReader = getProductByID(productID)
Dim thumbImg As String
Dim fullImg As String
While dr.Read()
'delete thumb
fullImg = context.Application("webRoot") &
"vendorImages/" & dr.Item("galleryFolder").ToString & "/" &
dr.Item("imageFull").ToString
fullImg = context.Current.Server.MapPath(fullImg)
Dim thisImgFull As New System.IO.FileInfo(fullImg)
thisImgFull.Delete()
End While
.... omitted for brevity
End Sub