Fórum Pegar valor do Descriptions das Tabelas #392518
15/12/2010
0
Adilson Rumao
Curtir tópico
+ 0Posts
17/12/2010
America Informatica
Vi isso em um sistema onde trabalho e gostei da maneira como foi feita, mas não consegui obter informações de como se fazer isso. Tentei fazer aqui, mas só consegui pegar as infomações do Display Label do ClientDataSet.
Se alguém puder me ajudar agredeço.
Gostei + 0
17/12/2010
Leonardo Xavier
var a:WideString; begin a:=dados.ADODataSet1.Sort; showmessage(a);
Gostei + 0
17/12/2010
Adilson Rumao
procedure TfrmTeste.Button1Click(Sender: TObject); var aLista: WideString; begin aLista:= sdsClientes.SortFieldNames; ShowMessage(aLista); end;
Gostei + 0
23/12/2010
Adilson Rumao
Gostei + 0
27/12/2010
Adilson Rumao
Gostei + 0
28/12/2010
Paulo Andrade
Gostei + 0
06/01/2011
Adilson Rumao
Gostei + 0
06/01/2011
Deivison Melo
Gostei + 0
07/01/2011
Adilson Rumao
Gostei + 0
12/07/2011
Adilson Rumao
Então no meu banco de dados sempre coloco os Descritions. Como abaixo.
Gostaria de aproveitar estas informações em um Combobox: Para ficar assim:
O Combobox que uso hoje funciona normalmente, mas pegos as informações do DisplayLabel, mas tenho que ficar alterando todos eles no CDS de cada tabela.
Como já faço isso ao criar as tabelas queria reaproveitar estas informações, mas não estou conseguindo.
Tentei fazer algum usando: RDB$DESCRIPTION mas, não estou conseguinfo filtrar as informações.
Se alguém pider ajudar, agradeço.
Gostei + 0
12/07/2011
Rafael Mattos
Gostei + 0
12/07/2011
Rafael Mattos
R.Rdb$DESCRIPTION
from rdb$Relation_Fields R, RDB$FIELDS F
where R.Rdb$Relation_Name = :NAME and F.rdb$field_name=R.Rdb$field_source
order by R.rdb$field_position, R.rdb$field_name
http://mundodoprogramador.wordpress.com/2011/05/16/sqls-interessantes-que-voce-pode-precisar-um-dia-firebird/
--------------------------------------------------------------------------------
Blog: http://mundodoprogramador.wordpress.com/
MSN: rafmattos@hotmail.com
Twitter: _rafmattos
Gostei + 0
12/07/2011
Emerson Nascimento
select rf.rdb$field_name nome, rf.rdb$field_id id, rf.rdb$field_position posicao, rf.rdb$description descricao from rdb$relations r
inner join rdb$relation_fields rf on rf.rdb$relation_name = r.rdb$relation_name
where r.rdb$relation_name = 'NOME_DA_SUA_TABELA'
ocorre que o campo description é um memo, então você precisa fazer o tratamento necessário para obter o valor dele.
Gostei + 0
13/07/2011
Adilson Rumao
A instrução que me passaram, roda de boa no IBExpert.
Estou tentando povoar o Combobox, mas ainda nada. Alguém pode dar uma olhada na minha Unit de teste?
Fiz a instrução abaixo, mas não estou entendendo como jogar ela para peencher ele.
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, WideStrings, DBXFirebird, FMTBcd, DB, SqlExpr, Provider,
DBClient;
type
TForm2 = class(TForm)
cbxField: TComboBox;
Conn: TSQLConnection;
sdsEstados: TSQLDataSet;
dspEstados: TDataSetProvider;
cdsEstados: TClientDataSet;
cdsEstadosCODIGO: TIntegerField;
cdsEstadosMARCA: TStringField;
cdsEstadosATIVO: TStringField;
cdsEstadosNOME: TStringField;
cdsEstadosSIGLA: TStringField;
cdsEstadosICMS: TIntegerField;
cdsEstadosIBGE: TIntegerField;
cdsEstadosDATAINC: TSQLTimeStampField;
cdsEstadosDATAALT: TSQLTimeStampField;
cdsEstadosRESPONSAVEL: TIntegerField;
DS: TDataSource;
private
function GetCampos(tablename: string): integer;
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
{ TForm2 }
function TForm2.GetCampos(tablename: string): integer;
var
Qry : TSQLQuery;
begin
Qry := TSQLQuery.Create(self);
Qry.SQLConnection := Conn;
Qry.SQL.Add('select rf.rdb$description descricao from rdb$relations r inner join rdb$relation_fields rf on rf.rdb$relation_name = r.rdb$relation_name where r.rdb$relation_name = '+tablename+'');
Qry.Open;
Result := Qry.Fields[0].AsInteger;
end;
end.
Gostei + 0
13/07/2011
Adilson Rumao
A instrução que me passaram, roda de boa no IBExpert.
Estou tentando povoar o Combobox, mas ainda nada. Alguém pode dar uma olhada na minha Unit de teste?
Fiz a instrução abaixo, mas não estou entendendo como jogar ela para peencher ele.
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, WideStrings, DBXFirebird, FMTBcd, DB, SqlExpr, Provider,
DBClient;
type
TForm2 = class(TForm)
cbxField: TComboBox;
Conn: TSQLConnection;
sdsEstados: TSQLDataSet;
dspEstados: TDataSetProvider;
cdsEstados: TClientDataSet;
cdsEstadosCODIGO: TIntegerField;
cdsEstadosMARCA: TStringField;
cdsEstadosATIVO: TStringField;
cdsEstadosNOME: TStringField;
cdsEstadosSIGLA: TStringField;
cdsEstadosICMS: TIntegerField;
cdsEstadosIBGE: TIntegerField;
cdsEstadosDATAINC: TSQLTimeStampField;
cdsEstadosDATAALT: TSQLTimeStampField;
cdsEstadosRESPONSAVEL: TIntegerField;
DS: TDataSource;
private
function GetCampos(tablename: string): integer;
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
{ TForm2 }
function TForm2.GetCampos(tablename: string): integer;
var
Qry : TSQLQuery;
begin
Qry := TSQLQuery.Create(self);
Qry.SQLConnection := Conn;
Qry.SQL.Add('select rf.rdb$description descricao from rdb$relations r inner join rdb$relation_fields rf on rf.rdb$relation_name = r.rdb$relation_name where r.rdb$relation_name = '+tablename+'');
Qry.Open;
Result := Qry.Fields[0].AsInteger;
end;
end.
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)