Mega Code Archive

 
Categories / Delphi / ADO Database
 

Select a table row by chance

Title: Select a table-row by chance Question: Answer: When starting the application you must call 'randomize' to let the function 'random' work right: procedure TForm1.FormCreate(Sender: TObject); begin Randomize; end; procedure TForm1.SetRandomDBCursor; begin Table1.First; Table1.MoveBy(Random(Table1.Recordcount)); end;