Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 1 of 1 total
Thread Odd problem with DBISAM v3.30 and a missing MEMORY table
Thu, Apr 12 2007 3:15 PMPermanent Link

Jeff Cook
I have a problem that is appearing on a user's system where they have just replaced a lame PC with a proper server.   Everyting else in the system
appears to be OK.

The problem appears on the user's system in both local mode (on the server) and in Client/Server mode.  It works perfectly in my test
environment.  

The program does the following:-

1. Create a MEMORY table using SQL.
2. Removes user selectable fields using SQL and DROP.
3. Export the MEMORY table to an Access database use SMExport.

Between steps 2 and 3 on the users machine we get an "DBISAM engine error #11010 table access.DAT".  I've put debugging code in and tested it
using Context Software's excellent Remote Assistant and I have marked in the code where the MEMORY table goes missing

The code is below.

TIA for any assistance.

Cheers

Jeff
====== definition of the memory table ===========
 object AccessTable: TDBISAMTable
   AutoDisplayLabels = False
   CopyOnAppend = False
   DatabaseName = 'MEMORY'
   EngineVersion = '3.30'
   TableName = 'Access'
   Left = 174
   Top = 268
 end
====== the code =========================
   with HTMLQuery do
   begin
     showmessage('memory table about to be created');
     if apmDM.CompanyTableWebPagesToAccess.AsBoolean then
     begin
       Close;
       UnPrepare;
       SQL.Clear;
       SQL.Add('SELECT W.*, P.Description AS Portfolio,');
       SQL.Add('       M.PMCode, M.Name AS PMName,');
       SQL.Add('       M.ShortName AS PMShortName,');
       SQL.Add('       M.Position AS PMPosition,');
       SQL.Add('       M.DayTimePhone AS PMDayTimePhone,');
       SQL.Add('       M.AfterHoursPhone AS PMAfterHoursPhone,');
       SQL.Add('       M.MobilePhone AS PMMobilePhone,');
       SQL.Add('       M.Email AS PMEmail');
       SQL.Add('INTO MEMORY Access');
       SQL.Add('FROM MEMORY WebProperties W');
       SQL.Add('LEFT OUTER JOIN Portfolios P ON P.PortfolioCode = W.PortfolioCode');
       SQL.Add('LEFT OUTER JOIN PropertyManagers M ON M.PMCode = P.PMCode');
       SQL.Add('WHERE Selected = True');
       Open;
       Close;
       Unprepare;
       showmessage('memory table created');
       // drop unwanted fields
       try
         with apmDM.qryGeneral do
         begin
           Close;
           SQL.Clear;
           SQL.Add('ALTER TABLE MEMORY Access');
           apmDM.OpenTable(apmDM.PropertyTable);
           apmDM.PropertyTable.FieldDefs.Update;
           DBIniFile := TIniFile.Create(apmDM.APMPath + '\apmdb.ini');
           try
             for i := 0 to apmDM.PropertyTable.FieldDefs.Count - 1 do
               if DBIniFile.ReadBool('AccessDB',
                 apmDM.PropertyTable.FieldDefs.Items[i].Name, True) = False then
               begin
                 SQL.Add('DROP ' + apmDM.PropertyTable.FieldDefs.Items[i].Name + ',');
                 s := 'DROP ' + apmDM.PropertyTable.FieldDefs.Items[i].Name;
               end;
           finally
             DBIniFile.Free;
           end;
           if SQL.Count > 1 then
           begin
             SQL.Strings[SQL.Count - 1] := s; // drop last comma
             showmessage('memory table about to drop unwanted fields');
             showmessage(SQL.Text);
             ExecSQL;
             showmessage('memory table dropped unwanted fields');
             Close;
             UnPrepare;
           end;
         end;
       except
         showmessage('memory table error dropping unwanted fields');
         apmDM.qryGeneral.UnPrepare;
         apmDM.qryGeneral.Close;
       end;
       try
         if AccessTable.Exists then  //<================= doesn't exist
         begin
           if apmDM.qryGeneral.Prepared then showmessage('query prepared')
           else if AccessTable.Active then showmessage('memory table active')
           else showmessage('memory table closed');
         end
         else showmessage('memory table does not exist');
         showmessage('memory table before open');
         AccessTable.Open;
         showmessage('memory table after open/before export');
         try
           SMExportToAccess.FileName := HTMLPath + '\WebPages\RentalProperties.MDB';
           SMExportToAccess.Execute;
           showmessage('memory table after export');
         except
           showmessage('memory table error exporting');
         end;
       except
         showmessage('memory table error opening');
       end;
       SMExportToAccess.FileName := HTMLPath + '\WebPages\RentalProperties.MDB';
       SMExportToAccess.Execute;
       AccessTable.Close;
     end;
.
.
.
Image