EDBClient with message ''

Hi all experts,

i have this strange error with clientdataset in delphi 2007 and firebird. Sometime i get
Project xxx.exe raised exception class EDBClient with message ''
and  sometimes not.
What can cause this error to rise? I've checked and all required fields is not empty.
Please help

Thanks
Regards,  Reynaldi
error.png
LVL 2
reynaldioAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

developmentguruPresidentCommented:
First the message says ''... not the contents of a field.  I have to ask, are you able to cause this error for testing purposes or does it happen randomly?  If it happens randomly then how often?

I use EurekaLog in order to get information on errors in my code when the code may be in use hundreds or even thousands of miles away.  It will show you a full call stack of exactly what the code was doing when the error happened, even include a screen shot if you want.

While I will have to wait on the answers to the questions I posed... you might want to try checking Use Debug DCUs and uncheck Optimization.  This will make it easier to debug.
0
reynaldioAuthor Commented:
Hi,

very sorry with the slow response. the debugger stops when clientdataset execute "post".

below is mycode

Thanks,
Reynaldi
procedure TBOC_ARReg.add(const Position, TrCode: String;
  const AccountID: Int64; const Amount: Currency; const JournalMemo: String);
begin
  with dsRegDT do
  begin
    Append;
    dsRegDTOBJID.AsInt64 := fSeqID;
    dsRegDTHEADER_ID.AsInt64 := dsRegHDOBJID.AsInt64;
    dsRegDTTR_CODE.AsString := TrCode;
    dsRegDTLR.AsString := Position;
    dsRegDTACCOUNT_ID.AsInt64 := AccountID;
    dsRegDTAMOUNT.AsCurrency := Amount;
    dsRegDTJRNMEMO.AsString := JournalMemo;
    Post;    
    Dec(fSeqID);
  end;
end;

Open in new window

0
reynaldioAuthor Commented:
hi,

and 1 more thing i forgot to mention. Error only occur when i post the second record. it is fine if the dataset only have 1 record

Thanks
Reynaldi.
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

developmentguruPresidentCommented:
One thing you may need to do is examine the exception more closely.  Place a try except block

try
except
  on e:Exception do
    MyStr := e.ClassName;
end;

Break on the MyStr := line.  This will show you the class of the exception.  Recompile with the "on e:" line showing the exact exception type.  Break it on that line again.  When it stops this time, look through all of the exception's properties.  You may find that there is an error message that is buried in sub properties.  This message could give you an important clue as to what is going on.

It sounds like the error is buried and it has to do with adding more than one record.  If you delete the first record, can you add a second one then?  What is the value of the DTOBJID field on the first try versus the second try?  In general the record ID is set by the database and should not be deliberately set by you, so you could try just commenting out that line.

If you are unable to solve the issue with this information, let me know the answer to each of my questions and we will try again.
0
reynaldioAuthor Commented:
Hi,

Thanks for your response.
i've tried your solution but it did not pass the exception line. Below is my code.


procedure TBOC_ARReg.add(const Position, TrCode: String;
  const AccountID: Int64; const Amount: Currency; const JournalMemo: String);
var
  i: Integer;
  s: String;
  mystr: String;
begin
  try
    with dsRegDT do
    begin
      MessageDlg('START', mtWarning, [mbOK], 0);

      Append;
      dsRegDTOBJID.AsInt64 := fSeqID;
      dsRegDTHEADER_ID.AsInt64 := dsRegHDOBJID.AsInt64;
      dsRegDTTR_CODE.AsString := Trim(TrCode);
      dsRegDTLR.AsString := Trim(Position);
      dsRegDTACCOUNT_ID.AsInt64 := AccountID;
      dsRegDTAMOUNT.AsCurrency := Amount;
      dsRegDTJRNMEMO.AsString := Trim(JournalMemo);

      MessageDlg('BEFORE POST', mtWarning, [mbOK], 0);
      Post;
      MessageDlg('END', mtWarning, [mbOK], 0);

      Dec(fSeqID);
    end;
  except
    on e:Exception do
    begin
      MyStr := e.ClassName;
      MessageDlg(MyStr, mtWarning, [mbOK], 0);
    end;
  end;
end;


the function call "MessageDlg('START', mtWarning, [mbOK], 0);" and "MessageDlg('BEFORE POST', mtWarning, [mbOK], 0);" on record#1 and record#2,
but record#2 did not call MessageDlg('END', mtWarning, [mbOK], 0);
so this must be an error when calling POST.



below is values i input to the fields.

Record#1:

dsRegDTOBJID:  -1
dsRegDTHEADER_ID:  -1
dsRegDTTR_CODE:  ar.payment
dsRegDTLR.AsString:  R
dsRegDTACCOUNT_ID:  117
dsRegDTAMOUNT:  -1000
dsRegDTJRNMEMO:  A/R Payment: test 1


Record#2:

dsRegDTOBJID:  -2
dsRegDTHEADER_ID:  -1
dsRegDTTR_CODE:  ar.payment
dsRegDTLR.AsString:  R
dsRegDTACCOUNT_ID:  117
dsRegDTAMOUNT:  -2000
dsRegDTJRNMEMO:  A/R Payment: test 1


note that record#1 and record#2 have a very similar values.
i did not add any function to OnChange or OnValidate on any fields

This is a very strange. I often get this EDBClient with message '', but mostly at random so it is difficult to track. But error on this function keep showing constantly. I have no idea what causing this error since the debugger did not give me a complete error message. I use JCL Debugger from jedi project.



i initially set OBJID because it is a required field, that is why i put a dummy value to the OBJID field or else delphi will raise an error. This ID will be overwritten by trigger in the database. Is this the right approach or you have a better solution?

Thanks,
Reynaldi
0
developmentguruPresidentCommented:
One more thing to try, add the first record, delete it, then add the second.  This will tell you if it is the database itself that has a problem with the second record being added after the first (as opposed to being added by itself).  If this is the case I would check the the table does not have more than one unique field, or that the table's primary key would not cause this.

The normal way I handle the ID field in this situation is to set the IDFields Required property to false.  You should not need to specify a value for that field.  If you deliberately set up the fields yourself in the IDE then you should be able to change the required property in the IDE.  If not, you will need to change it at runtime (just after opening the dataset I would think).
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
reynaldioAuthor Commented:
hi,

i'm sorry for the late response. i followed what you suggested developmentguru, and found that apparently i had a unique key contraint which causing this error. i don't know why i could have missed that. silly me. but everything works fine now. i still get that error sometimes in my reporting module (view only). but first i'm gonna check that more thoroughly :) and post another question when i cannot find the solution.

Thanks for all your help

Regards,
Reynaldi
0
reynaldioAuthor Commented:
Thanks for your help.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Databases

From novice to tech pro — start learning today.