Fórum Ajuda no SQL #348845
12/11/2007
0
Estou iniciando em Delphi e sql. Preciso de uma ajuda.
Em um form estou solicitando que o usuário informe a sigla do Estado e gostaria de pesquisar na tabela estados se a sigla informada existe e mostrar o nome do estado. EStou fazendo como está abaixo, mas esta com erro.
Alguém pode me ajudar?
QRY_estados.close;
QRY_estados.SQL.clear;
QRy_estados.SQL.add(´select nome from tabela_estados where
abreviatura = DBEdit6.text´);
Rsa_tche
Curtir tópico
+ 0Posts
12/11/2007
Comodelphi
QRY_estados.close;
QRY_estados.SQL.clear;
QRy_estados.SQL.add(´select nome from tabela_estados where
abreviatura = ´+ quotedstr(DBEdit6.text));
Gostei + 0
12/11/2007
Rsa_tche
: Unterminated string
: ´)´ expected but identifier ´abreviatura´ found
: ´:=´ expected but ´=´ found
: Could not compile used unit ´exemplo_u.pas´
QRY_estados.close;
QRY_estados.SQL.clear;
QRy_estados.SQL.add(´select nome from tabela_estados where
abreviatura = DBEdit6.text´);
Gostei + 0
12/11/2007
Jeimyson
With Qry_Estados do begin Sql.Clear; Sql.Add(´SELECT NOME FROM TABELA_ESTADOS ´); Sql.Add(´ WHERE AVREVIATURA = :ABREVIATURA ´); ParamByName(´ABREVIATURA´).AsString := DBEdit6.text; Open; end;
8)
Gostei + 0
12/11/2007
Comodelphi
QRY_estados.SQL.clear;
QRy_estados.SQL.add(´select nome from tabela_estados where abreviatura = ´ + quotedstr(DBEdit6.text));
observe a quebra de linha: ou vc mantem a instruação na mesma linha ou quebra o texto na linha debaixo:
QRY_estados.close;
QRY_estados.SQL.clear;
QRy_estados.SQL.add(´select nome from tabela_estados ´ +
´where abreviatura = ´ + quotedstr(DBEdit6.text));
Gostei + 0
12/11/2007
Rsa_tche
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)