Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- begin
- //Criar e Configurar um query
- with TSQLQuery.Create(Nil) do
- Try
- Try
- DataBase := Mainform.aSQLConnection;
- Transaction := Mainform.aSQLConnection.Transaction;
- SQL.Clear;
- SQL.Add('Select * From Departamento Order By DepNum');
- //Ir buscar os dados
- Open;
- //Preencher a combobox com o número de departamento
- while not eof do
- begin
- cbDepNum.items.add(fieldbyname('DepNum').AsString);
- next;
- end;
- //Colocar o primeiro elemento da lista como ativo...
- if cbDepNum.Items.Count > 0 then
- cbDepNum.ItemIndex:= 0 ;
- Finally
- if Active then
- Close;
- Free;
- end
- //Se alguma coisa funcionou mal...
- //... mostrar uma mensagem e...
- Except
- on E:exception do
- begin
- ShowMessage(e.message);
- end;
- end;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement