Search code examples
delphiexceptiontclientdataset

Any way to find out which TField is raising EDBClient with message 'Field value required.'?


I have one TClientDataSet with several Fields and I'm getting this exception, I'm sure that I forgot to set one field value, but the question is, which Field?

Is there some way to find out quickly which field is raising this exception?

EDIT

I solved the problem, I was connecting the TClientDataSet to the wrong provider, which had a required field on the server but didn't have this field on the client.

But it still doesn't invalidate my question, I lost a lot of time to figure it out, and if I had some way to know which server side required field was raising this error it would be very quick to realise what was my mistake.

EDIT 2

Related QCs:

#5557 - Solved as "As Designed".

#54380 - Open


Solution

  • When the debugger notifies you of the exception, look at the call stack. Navigate to the routine that is iterating over the list of fields, and inspect the loop-control variable at that point to find out how far through the field list your program got before raising an exception.

    If the loop-control variable isn't accurate, then set a breakpoint in that routine and re-run your program. Step through until you get the exception again.

    Another option is to look at all the fields and see for yourself which one lacks a value.