Page 1 of 1

Order table

Posted: Fri 20 Feb 2009 12:28
by JoaoSantosG
Hello, i'm sorry if this was already discussed, but i couldn't find it.
I have 3 MyTable, related between then,
In the 3rd table i'm inserting some data, i want that the field "IDTempo" only have 40 values, and that they appear in order. The problem is that when i insert the first value, it goes to the last place on the table and remains there. When i insert the other values they always go to the second last position. Thank you for the help.
Best regards

Code: Select all

	//Vai buscar o Ășltimo tempo inserido
	TIR500Tempos->Last();
	int IDtempo = TIR500Tempos->FieldByName("IDTempo")->AsInteger;

	if(IDtempo > 40){
		MessageDlg(LoadMsg(555), mtError, TMsgDlgButtons() Insert();
	TIR500Tempos->FieldByName("IDTempo")->AsInteger = IDtempo;
	TIR500Tempos->FieldByName("Clip")->AsString     = Clip;
	TIR500Tempos->FieldByName("Tempo")->AsInteger   = Tempo;
	TIR500Tempos->Post();

Posted: Tue 24 Feb 2009 08:34
by Dimon
To solve this problem you should use the TDataset.Append method instead of Insert.

Posted: Fri 27 Feb 2009 23:45
by JoaoSantosG
Thank you for the help- It worked.