Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Issues with GetData



Permlink Replies: 1 - Last Post: Jan 22, 2018 6:32 AM Last Post By: Mark Williams Threads: [ Previous | Next ]
Mark Williams

Posts: 120
Registered: 5/8/10
Issues with GetData
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 21, 2018 6:52 AM
I am getting an inconsistent access violation working with the GetData function with table rows. Sometimes I run my app and getData works every time. Other times I run it and it fails every time. It doesn't seem to matter whether there is a recompile or not.

The code is as follows
btnID.Caption := 'ID: '+varToStr(FDQuery.sourceView.rows[Index].GetData(documents_id));
lPath.Caption:=getDocumentFullPath(FDQuery, index);


Setting the caption of btnID always works. Setting lPath.caption works sometimes and not others.

The function GetDocumentFullPath is declared

Function getDocumentFullPath(FDQuery:TFDQuery; index:integer):string;
begin
  Result:=getDocumentFullPath(FDQuery.SourceView.Rows[Index]);
end;


It passes a TFDDatsRow paramater to an overloaded function declared (relevant extract only)

Function getDocumentFullPath(Row:TFDDatSRow):string;
  var 
     fp : variant;
begin
  with Row do
    begin
      if GetData(documents_tab_type)<>0 then
        exit;
 
 
      fp:=GetData(documents_file_path); {crashes here}
end;


In the overloaded function it handles the documents_tab_type field with no problem, but not the assigning of the documents_file_path to the variant fp.

Can anyone advise why this is intermittently causing me problems?

I am working with MySQl. "documents_file_path" is a varchar with a length of 300.
Mark Williams

Posts: 120
Registered: 5/8/10
Re: Issues with GetData
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 22, 2018 6:32 AM   in response to: Mark Williams in response to: Mark Williams
Re-posted a s a question!
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02