Curious problem with SaveToFile

From: Guillem (guillemvicens_at_clubgreenoasis.com)
Date: 03/11/05

  • Next message: Zoquo9_at_gmail.com: "Re: the file is not a valid compound file"
    Date: Fri, 11 Mar 2005 14:58:36 +0100
    
    

    Hi,

    I've got an app that receives requests for a MySQL 4.01 DB, gets the data
    using ADO (MDAC 2.7), saves it to XML and sends it. It all worked fine until
    recently I needed to make grow my database, i.e., add new tables,
    relationships and so on.

    Well, curiously for one of the new tables (and only this one) when I try to
    do SaveToFile I get an EOleException with "Unspecified error". Boy, I hate
    these ones, how are you supposed to fix a bug if you don't know the error?
    Mentalism? Voodoo?? Endless grabing and guessing: "oh, maybe if i do this
    then i will have that" :(

    Whatever, i post the code here. It's called from within a thread (that's why
    i call the CoInitialize and CoUninitialize) and it could be that another
    thread tries to access the dataset at the same time (unlikely but possible,
    reason for tcriticalsection). The table which I have the problem with has
    only integer and varchar data.

      BloqSeguridad.Acquire; //tCriticalSection
      try
        coInitialize(nil);
        with ADOSetDatos do //ADOSetDatos is a TADODataset
        begin
          ADOSetDatos.Close;
          CommandText := 'select ' + columnas + ' from ' + tabla + ' ' + param;
    //columnas, tabla and param are all string parameters
          CommandType := cmdText;
          Open;
          if FileExists(tabla + '.xml') then
            DeleteFile(tabla + '.xml');
          SaveToFile(tabla + '.xml'); <-----at this point i get the
    exception
        end;
      finally
        coUninitialize();
        BloqSeguridad.Release;
      end;

    Btw, i ported the app from D7 Pro to D2005 Pro Update 1. Don't think the
    problem lies there, but ... Has anyone an idea what it could be?

    -- 
    Best regards :)
    Guillem Vicens
    Dep. informática Green Service SA
    guillemvicens@clubgreenoasis.com
    www.clubgreenoasis.com 
    

  • Next message: Zoquo9_at_gmail.com: "Re: the file is not a valid compound file"