Hello to all.
I have and strange and complicated problem.
My asp.net application raise errors when the data that the user input is
invalid. For example: The user didn't fill all some data (customer name or
SSN and so on). I have a class that try to validate the data and is
something is wrong it raises an error. That error is a class that I made,
this class inherits from System.Exceptio. So far so good.
It works fine, but only in 2 classes it doesn't work. I fire my error when
the data isn't correct but in the webpage the error is an
System.Reflection.TargetInvocationException that has as a inner exception
the error that I fire.
I will put some code to make it clear
WEB FORM
Private sub SaveData()
Declare BRL as NEW Customer
'Fill the brl object
With BRL
.Name = txtName.Text
.SSN = txtSSN.Text
...
End With
Try
BRL.CheckSaveRules
BRL.Save
Catch ex As ValidationRowException
'Display an alert message to the user
ShowMessage(ex.Message, Page_MessageBox.MsgType.CriticalInformation)
Catch ex As System.Reflection.TargetInvocationException
'this catch it wasn't suppose to exist.
'This is the error that the web form catch and I don't know why.
Catch ex As Exception
ShowUnKnowError
Finally
BRL.Dispose()
End Try
End sub
BRL
Public sub CheckSaveRules
'Creates an instance of the validator object and get the not null fields of
this dataTable
Dim validation As New RecordCommonValidation(GetRequiredFields)
'Gets a row with all the data to be validated
Dim row As DataRow = FillTableOP()
'Calls the validate method of the Validation Class
validation.Validate(row)¨
'Some other validations
....
End sub
FramekWork Validation Class
Public Sub Validate(ByVal RowToValidate As DataRow)
'Check each cell of the row and if any of the are null (and it wasn't
suppose to be null) raises the error
Throw New ValidationRowException(Enums.RowFailType.NotField,
Consts.NotFillMessage)
...
End sub
It is a long post I know but I don't know what else I can try to resolve
this strange thing. 3 1300
It's a tricky one, but I have a number of guesses
I doubt this is it, but make sure Dispose() isn't the problem
Also, it's possibly an issue with exception serialization. Your custom
exceptions should implement ALL exception constructors as they are used
internally by the .net framework only god (brad adams) knows how. HEre's a
pretty good post which covers it: http://software.gurock.com/articles/...ons-in-dotnet/
Also, remember that BRL was disposed of after the finally, so you can't be
using it later on.
Karl
-- http://www.openmymind.net/
"Henrry Pires" <Nelson@Don'tuse.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl... Hello to all.
I have and strange and complicated problem. My asp.net application raise errors when the data that the user input is invalid. For example: The user didn't fill all some data (customer name or SSN and so on). I have a class that try to validate the data and is something is wrong it raises an error. That error is a class that I made, this class inherits from System.Exceptio. So far so good.
It works fine, but only in 2 classes it doesn't work. I fire my error when the data isn't correct but in the webpage the error is an System.Reflection.TargetInvocationException that has as a inner exception the error that I fire.
I will put some code to make it clear WEB FORM Private sub SaveData() Declare BRL as NEW Customer 'Fill the brl object
With BRL
.Name = txtName.Text
.SSN = txtSSN.Text
..
End With Try BRL.CheckSaveRules
BRL.Save Catch ex As ValidationRowException
'Display an alert message to the user
ShowMessage(ex.Message, Page_MessageBox.MsgType.CriticalInformation)
Catch ex As System.Reflection.TargetInvocationException
'this catch it wasn't suppose to exist.
'This is the error that the web form catch and I don't know why.
Catch ex As Exception
ShowUnKnowError
Finally
BRL.Dispose()
End Try End sub BRL Public sub CheckSaveRules 'Creates an instance of the validator object and get the not null fields of this dataTable
Dim validation As New RecordCommonValidation(GetRequiredFields)
'Gets a row with all the data to be validated
Dim row As DataRow = FillTableOP() 'Calls the validate method of the Validation Class
validation.Validate(row)¨ 'Some other validations
... End sub FramekWork Validation Class Public Sub Validate(ByVal RowToValidate As DataRow) 'Check each cell of the row and if any of the are null (and it wasn't suppose to be null) raises the error Throw New ValidationRowException(Enums.RowFailType.NotField, Consts.NotFillMessage)
...
End sub It is a long post I know but I don't know what else I can try to resolve this strange thing.
Many thanks Karl for the help :-)
"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
net> wrote in message news:er****************@TK2MSFTNGP09.phx.gbl... It's a tricky one, but I have a number of guesses
I doubt this is it, but make sure Dispose() isn't the problem Also, it's possibly an issue with exception serialization. Your custom exceptions should implement ALL exception constructors as they are used internally by the .net framework only god (brad adams) knows how. HEre's a pretty good post which covers it: http://software.gurock.com/articles/...ons-in-dotnet/
Also, remember that BRL was disposed of after the finally, so you can't be using it later on.
Karl -- http://www.openmymind.net/ "Henrry Pires" <Nelson@Don'tuse.com> wrote in message news:%2****************@TK2MSFTNGP11.phx.gbl... Hello to all.
I have and strange and complicated problem. My asp.net application raise errors when the data that the user input is invalid. For example: The user didn't fill all some data (customer name or SSN and so on). I have a class that try to validate the data and is something is wrong it raises an error. That error is a class that I made, this class inherits from System.Exceptio. So far so good.
It works fine, but only in 2 classes it doesn't work. I fire my error when the data isn't correct but in the webpage the error is an System.Reflection.TargetInvocationException that has as a inner exception the error that I fire.
I will put some code to make it clear WEB FORM Private sub SaveData() Declare BRL as NEW Customer 'Fill the brl object
With BRL
.Name = txtName.Text
.SSN = txtSSN.Text
..
End With Try BRL.CheckSaveRules
BRL.Save Catch ex As ValidationRowException
'Display an alert message to the user
ShowMessage(ex.Message, Page_MessageBox.MsgType.CriticalInformation)
Catch ex As System.Reflection.TargetInvocationException
'this catch it wasn't suppose to exist.
'This is the error that the web form catch and I don't know why.
Catch ex As Exception
ShowUnKnowError
Finally
BRL.Dispose()
End Try End sub BRL Public sub CheckSaveRules 'Creates an instance of the validator object and get the not null fields of this dataTable
Dim validation As New RecordCommonValidation(GetRequiredFields)
'Gets a row with all the data to be validated
Dim row As DataRow = FillTableOP() 'Calls the validate method of the Validation Class
validation.Validate(row)¨ 'Some other validations
... End sub FramekWork Validation Class Public Sub Validate(ByVal RowToValidate As DataRow) 'Check each cell of the row and if any of the are null (and it wasn't suppose to be null) raises the error Throw New ValidationRowException(Enums.RowFailType.NotField, Consts.NotFillMessage)
...
End sub It is a long post I know but I don't know what else I can try to resolve this strange thing.
Did any of it work? :)
Karl
--
MY ASP.Net tutorials http://www.openmymind.net/
"Henrry Pires" <Nelson@Don'tuse.com> wrote in message
news:ep**************@TK2MSFTNGP11.phx.gbl... Many thanks Karl for the help :-)
"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> wrote in message news:er****************@TK2MSFTNGP09.phx.gbl... It's a tricky one, but I have a number of guesses
I doubt this is it, but make sure Dispose() isn't the problem Also, it's possibly an issue with exception serialization. Your custom exceptions should implement ALL exception constructors as they are used internally by the .net framework only god (brad adams) knows how. HEre's a pretty good post which covers it: http://software.gurock.com/articles/...ons-in-dotnet/
Also, remember that BRL was disposed of after the finally, so you can't be using it later on.
Karl -- http://www.openmymind.net/ "Henrry Pires" <Nelson@Don'tuse.com> wrote in message news:%2****************@TK2MSFTNGP11.phx.gbl... Hello to all.
I have and strange and complicated problem. My asp.net application raise errors when the data that the user input is invalid. For example: The user didn't fill all some data (customer name or SSN and so on). I have a class that try to validate the data and is something is wrong it raises an error. That error is a class that I made, this class inherits from System.Exceptio. So far so good.
It works fine, but only in 2 classes it doesn't work. I fire my error when the data isn't correct but in the webpage the error is an System.Reflection.TargetInvocationException that has as a inner exception the error that I fire.
I will put some code to make it clear WEB FORM Private sub SaveData() Declare BRL as NEW Customer 'Fill the brl object
With BRL
.Name = txtName.Text
.SSN = txtSSN.Text
..
End With Try BRL.CheckSaveRules
BRL.Save Catch ex As ValidationRowException
'Display an alert message to the user
ShowMessage(ex.Message, Page_MessageBox.MsgType.CriticalInformation)
Catch ex As System.Reflection.TargetInvocationException
'this catch it wasn't suppose to exist.
'This is the error that the web form catch and I don't know why.
Catch ex As Exception
ShowUnKnowError
Finally
BRL.Dispose()
End Try End sub BRL Public sub CheckSaveRules 'Creates an instance of the validator object and get the not null fields of this dataTable
Dim validation As New RecordCommonValidation(GetRequiredFields)
'Gets a row with all the data to be validated
Dim row As DataRow = FillTableOP() 'Calls the validate method of the Validation Class
validation.Validate(row)¨ 'Some other validations
... End sub FramekWork Validation Class Public Sub Validate(ByVal RowToValidate As DataRow) 'Check each cell of the row and if any of the are null (and it wasn't suppose to be null) raises the error Throw New ValidationRowException(Enums.RowFailType.NotField, Consts.NotFillMessage)
...
End sub It is a long post I know but I don't know what else I can try to resolve this strange thing.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Bo Peng |
last post by:
Dear Python group:
I am planning on an application that involves several complicated C++
classes. Basically, there will be one or two big data objects and some
"action" objects that can act on...
|
by: Max |
last post by:
Yeah, I know. It's the price we pay for forsaking variable declarations.
But for java programmers like me, Py's scoping is too complicated.
Please explain what constitutes a block/namespace, and...
|
by: Agoston Bejo |
last post by:
Hi, I'm having trouble with implementing some constraints on the database
level. An example:
--Table A(AID, BID ref. B.BID, ATXT)
--Table B(BID, CID ref. C.CID)
--Table C(CID)
upon insertion...
|
by: Narine |
last post by:
Hi All,
I need to write one complicated update statement and I'm looking at
maybe finding a simpler way to do it.
I have 2 tables:
1.Photo Table
PhotoID FileName
1 111.jpg
|
by: windandwaves |
last post by:
Hi Gurus
I am trying to make this rather complicated maps with an a huge number of mouseovers and the like.
I want to set up a function that OnMouseDown swaps the OnMouseOver and OnMouseOut for...
|
by: Adam Teasdale Hartshorne |
last post by:
Using the code below I get a very stange result. I assume that I must be
doing something wrong, but I can't figure out what it is.
getTriangleEdges(t,t1e) ;
for (int i = 0 ; i <...
|
by: Sweety |
last post by:
hello to all members,
i have strange question in C.
main()
{
printf("%d",main) ;
}
here o/p is same for all m/c in TC++ version 3.0 i.e 657.
I think this is not garbage.
|
by: Just D |
last post by:
Hi,
I need to write a serialization (to XML string) and restoring (from XML
string) of a very complicated object. The object uses a few classes, one
class has two ArrayLists, etc. The general...
|
by: fAnSKyer/C# newbie |
last post by:
I want use C# or even C++, C to do some complicated math works, like
calculaus~~
I wander if C# provide any complicated math package, like MATLAB
Thanks a lot
Cheers
fAnS
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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: 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...
|
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: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |