Recent

Author Topic: 1.6.2 Crashing with various error messages  (Read 1781 times)

KarenT

  • Full Member
  • ***
  • Posts: 120
1.6.2 Crashing with various error messages
« on: May 23, 2017, 01:13:04 am »
Having moved over to Linux a week or so back, I am re-writing some Delphi programs, not actually porting them or using the "Tools-Delphi" options, but a lot of stuff is copyable across.

Using SQLdb and nothing fancy going on, I am getting errros/crashes that change.

When opening a specific sub-Form, I empty a Table and sometimes get "Cannot perform that on a closed dataset." But then at other times I get "Dataset is read only" and then again, "cannot perform that on an active dataset."

If I click "Break" on the error message it takes me to different places in the source, rarely the same spot. It seems to have scrambled it's brains. I can open and change data in the Firefox Sqlbrowser OK. I checked the Ubuntu/Mint file permissions and all three levels are "Read and write". Tried a full rebuild same problem.

The weird thing is this used to work and I have not changed anything in that section since it was working a two days back.

Code: Pascal  [Select][+][-]
  1. procedure TblClear(const sqlQry : TSQLQuery);
  2. begin
  3.   if sqlQry.RecordCount > 0 then // It is OK until this line then breaks and  
  4.   begin                                         // throws me to somewhere else in the source
  5.     sqlQry.Last;
  6.     while not(sqlQry.BOF) do
  7.       sqlQry.Delete;
  8.   end;
  9. end;
  10.  

talorigomat

  • Jr. Member
  • **
  • Posts: 96
Re: 1.6.2 Crashing with various error messages
« Reply #1 on: May 23, 2017, 11:49:04 am »
Check whether elsewhere in your code you have not changed the state of the dataset before calling your function to clear the table.

Cannot perform that on a closed dataset. - Check whether you are commiting data and not reopening the TSQLQuery.  If you have set the property sqoKeepOpenOnCommit  to True then you wouldn't need to reopen the dataset after a commit.

Dataset is read only - is the dataset pulling information from two or more tables?





Lazarus 1.8.0Rc4, Windows 10

KarenT

  • Full Member
  • ***
  • Posts: 120
Re: 1.6.2 Crashing with various error messages
« Reply #2 on: May 23, 2017, 04:43:53 pm »
Thank you, I will check.

 

TinyPortal © 2005-2018