Page 1 of 1

conversion error from string

Posted: 12.03.2009, 20:56
by haentschman
Hi all...

i have a problem with a simple SQL under VISTA Home Premium.

first of all i dont know it is a ZeosDBO Problem but i hope you can help. :roll:

the code: PS: the positions of the Text are :shock: but i cant do it better here :oops:

Code: Select all

try
  ZQueryStatistikKunde%u3a= TZQuery.Create%u28self%u29;
  ZQueryStatistikKunde.Connection%u3a= DMDB.ZConnection1;
  try
    for M%u3a= 1 to 12 do
       begin
          ZQueryStatistikKunde.SQL.Text%u3a= 'select count%u28ID%u29 from       BEHANDLUNG where DATUM between %u3aDatum1 and %u3aDatum2 and KUNDENNUMMER = %u3aKunde';
          ZQueryStatistikKunde.ParamByName%u28'Datum1'%u29.AsDate%u3a= StartOfAMonth%u28Jahr,M%u29;
          ZQueryStatistikKunde.ParamByName%u28'Datum2'%u29.AsDate%u3a= EndOfAMonth%u28Jahr,M%u29;
          ZQueryStatistikKunde.ParamByName%u28'Kunde'%u29.Value%u3a= ZQueryKundenDetail.FieldValues%u5b'KUNDENNUMMER'%u5d;
          ZQueryStatistikKunde.Open;
                        SeriesPat.Add%u28ZQueryStatistikKunde.FieldValues%u5b'COUNT'%u5d,IntToStr%u28M%u29,clRed%u29;
        end;

     except
         FehlerCode%u3a= 'E255';
         Fehlerstatus%u3a= False;
         Fehlertext%u3a= 'Statistik einlesen fehlgeschlagen. ';
         raise;
      end;

    finally
       ZQueryStatistikKunde.Free;
    end;
- Firebird 2.0
- ZeosDBO 6.6.2
- Datum1 is the first day of the month
- Datum2 is the last day of the Month
- Kunde ist at every time the String "B7300" for testing
- the DATUM Field is a Date Field in Database
- the KUNDENNUMMER Field is a String Field in Database

what do the code
- it read the count from every Month 1-12 from the active Year.
- add the count to the TChart Series

the problem:
- the code works under XP :gruebel:
- under Vista Home Premium i have the error like the Attachment
- the error comes with the ZQueryStatistikKunde.Open at the 2nd loop

what i have do:
- the exe File too, which works under XP, raise the error under Vista
- changing the code into different variants
- also creating and release the ZQuery-Object during every loop
- everytime i have the error

what i have found out:
- the error comes only in February, var M = 2 and when the parameter Kunde have a String including alphanumeric Chars. Kunde like "1234" works :gruebel:
- in January and March to December the code works :gruebel:
- the parameters at the 2nd loop are correct
Datum1 = the date Value of 01.02.2009
Datum2 = the date Value of 28.02.2009
Kunde = "B7300"
- the same code in a other Application works under this Vista :gruebel:

i hope you can help me...thanks for a answer 8)

I found the error

Posted: 14.03.2009, 19:23
by haentschman
:shock: the Database File himself is corrupted :shock:

I dont know why :gruebel:

That works:
select count(ID) from BEHANDLUNG
where cast(kundennummer as varchar(30)) = 'A0815'

without the cast .... the error :gruebel:

the Colum "KUNDENNUMMER" was corrupted :shock:

Thanks for your Time :up: