Order table

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
JoaoSantosG
Posts: 9
Joined: Fri 20 Feb 2009 12:23

Order table

Post by JoaoSantosG » Fri 20 Feb 2009 12:28

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

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Tue 24 Feb 2009 08:34

To solve this problem you should use the TDataset.Append method instead of Insert.

JoaoSantosG
Posts: 9
Joined: Fri 20 Feb 2009 12:23

Post by JoaoSantosG » Fri 27 Feb 2009 23:45

Thank you for the help- It worked.

Post Reply