View Single Post
  #3 (permalink)  
Old December 29th, 2008, 08:56 AM
jn148 jn148 is offline
Authorized User
 
Join Date: Aug 2008
Location: , , .
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default SQLException is not defined?

Thanks Imar!!

I have about 100 pages of reading to finish up to get there (I am still just starting the LINQ chapter...)

But I am dealing with a client who has this need now. When I simply add the code on page 500 to my GridView:

Code:
ProtectedSub dsCategories_Deleted(ByVal sender AsObject, ByVal e As System.Web.UI.WebControls.SqlDataSourceStatusEventArgs) Handles dsCategories.Deleted
If e.Exception IsNotNothingAndAlsoTypeOf (e.Exception) Is sq SqlException Then
Dim myException As SqlException = CType(e.Exception, SqlException)
If myException.Number = 547 Then
Message.Text = "Sorry, you cannot delete this Category because " & _
"it has associated plans that you need to delete or " & _
"reassign first"
e.ExceptionHandled = True
EndIf
EndIf
EndSub
and try to load the page, I get the error: "Type 'SqlException' is not defined"

I am struggling to find time to finish my reading, while working on client projects ... any chance you could give me a quick hint of where I need to define the SQLException to help me limp along until I get my reading done?

Let me know - thanks again!
Reply With Quote