Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Go Back   Foros Club Delphi > Principal > SQL
Register FAQ Members List Calendar Guía de estilo Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #10  
Old 12/03/2010
Caral's Avatar
[Caral] Caral is offline
Miembro Premium
 
Join Date: Aug 2006
Posts: 7,659
Poder: 28
Caral Va por buen camino
Hola
Sabiendo que la sentencia SQL es string se puede hacer casi cualquier cosa, un ejemplo:
Código Delphi [-]
procedure TForm3.BitBtn4Click(Sender: TObject);
var Texto: String;
begin
 Texto:= 'where clave = '+quotedstr(combobox1.Text)+' order by nombres asc';
 with datam.Query1 do begin;
 close;
 sql.Clear;

if radioButton1.Checked = true then
begin
sql.Text:= 'select NOMBRES,MATRICULA,CLAVE,A1 from 20092'+Texto;
open;
edit;
end;

if radioButton2.Checked = true then
begin
sql.Text:= 'select NOMBRES,MATRICULA,CLAVE,A2 from 20092'+Texto;
open;
edit;
end;

if radioButton3.Checked = true then
begin
sql.Text:='select NOMBRES,MATRICULA,CLAVE,A3 from 20092'+Texto;
open;
edit;
end;

if radioButton4.Checked = true then
begin
sql.Text:= 'select NOMBRES,MATRICULA,CLAVE,A4 from 20092'+Texto;
open;
edit;
end;

if radioButton5.Checked = true then
begin
sql.Text:= 'select NOMBRES,MATRICULA,CLAVE,A5 from 20092'+Texto;
open;
edit;
end;

if radioButton6.Checked = true then
begin
sql.Text:= 'select NOMBRES,MATRICULA,CLAVE,A6 from 20092'+Texto;
open;
edit;
end;

if radioButton7.Checked = true then
begin
sql.Text:= 'select NOMBRES,MATRICULA,CLAVE,A7 from 20092'+Texto;
open;
edit;
end;

if radioButton8.Checked = true then
begin
sql.Text:= 'select NOMBRES,MATRICULA,CLAVE,A8 from 20092'+Texto;
open;
edit;
end;

if radioButton9.Checked = true then
begin
sql.Text:= 'select NOMBRES,MATRICULA,CLAVE,A9 from 20092'+Texto;
open;
edit;
end;

if radioButton10.Checked = true then
begin
sql.Text:= 'select NOMBRES, MATRICULA,CLAVE,A10 from 20092'+Texto;
open;
edit;
end;

end;
De esta manera no se repite el codigo constantemente.
Saludos
__________________
Siempre Novato
Reply With Quote
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Hacer que una columna de un DbGrid aparezca distinta según valor Aprendiendo OOP 11 30/11/2018 14:47
error de sql server "Informacion de columna clave insuficiente" jhcaboverde Conexión con bases de datos 1 17/08/2007 19:40
Informacion de columna clave insuficiente para realizar la operacion update o refresh Cabanyaler MS SQL Server 11 04/06/2007 13:25
informacion de columna clave insuficiente vipernet MS SQL Server 6 07/09/2006 20:26
Extraer datos de una pagina en java que tiene clave (sabiendo la clave claro) ;) kalimocho Internet 2 29/06/2005 05:11


All times are GMT +2. The time now is 21:38.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi