MemData Assertion fail
Posted: Mon 02 Mar 2009 22:13
Hello, I have a Thread that opens an Excel file and loads the data from the file. After reading the data, i call a funcion in the main Form (if i have this function in the thread it always gives me Eexception errors!), to insert the data in the Database.
The function is described bellow:
The table has 2 additional columns: an ID key and a foreign key, that are not in the code.
My problem is: if a put this line of code:
the program gives me an MemData error exception.
If i don't put that line of code, it gives me a key violation, when the data is being inserted.
Thanks in advance.
Best regards,
João
The function is described bellow:
Code: Select all
void __fastcall TForm4::InsereTempos(AnsiString Tempo, AnsiString Clip)
{
int tempo;
try{
tempo = StrToInt(Tempo);
}
catch(...){
tempo = 1;
}
if(tempo >99){
tempo = 99;
}
else if(tempo Last();
int IDtempo = Form4->TIR500Tempos->FieldByName("IDTempo")->AsInteger;
IDtempo++;
Form4->TIR500Tempos->Append();
Form4->TIR500Tempos->FieldByName("IDTempo")->AsInteger = IDtempo;
Form4->TIR500Tempos->FieldByName("Clip")->AsString = Clip;
Form4->TIR500Tempos->FieldByName("Tempo")->AsInteger = tempo;
Form4->TIR500Tempos->Post();
Form4->TIR500Tempos->Refresh();
}My problem is: if a put this line of code:
Code: Select all
Form4->TIR500Tempos->Refresh();If i don't put that line of code, it gives me a key violation, when the data is being inserted.
Thanks in advance.
Best regards,
João