Page 1 of 1

MemData Assertion fail

Posted: Mon 02 Mar 2009 22:13
by JoaoSantosG
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:

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();
}
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:

Code: Select all

Form4->TIR500Tempos->Refresh();
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

Posted: Tue 03 Mar 2009 11:57
by Dimon
I could not reproduce the problem. Please send me a complete small sample to dmitryg*devart*com to demonstrate it, including a script to create and fill table.

Also supply me the following information:
- the exact version of MyDAC. You can see it in the About sheet of TMyConnection Editor;
- the exact version of your IDE.