JEJEJE CAPTURE LA EXCEPCION JEJEJE DEJO EL CODIGO
Código Delphi
[-]with Fmodulo.qry_registra do
begin
SQL.Clear;
SQL.Add('select * from volantes');
SQL.Add('where volante=:volante_a_buscar');
Parameters.ParamByName('volante_a_buscar').Value:=Trim(wbuscar);
try
open;
if not Fmodulo.qry_registra.IsEmpty then
begin
Fregistro.wmodificar:=FieldByname('id_volante').AsString;
Fregistro.txtoficio.Text:=FieldByname('volante').AsString;
Fregistro.txtremitente.Text:=FieldByname('remitente').AsString;
Fregistro.txtfirmado.Text:=FieldByname('firmado_por').AsString;
fregistro.txtasunto.Text:=FieldByname('asunto').AsString;
Fregistro.txtrecibio.Text:=FieldByname('recibe').AsString;
fregistro.txtarchivo.Text:=FieldByname('archivo_en').AsString;
ShortDateFormat := 'dd/mm/yyyy';
fregistro.dtp_fecha_oficio.Date:=StrToDate(FieldByname('fecha_oficio').asString);
fregistro.dtp_fecha_recibido.Date:=StrToDate(FieldByname('fecha_recibido').asString);
try
Fregistro.dtp_fecha_turno.DateTime:=StrToDate(FieldByname('fecha_turnado').AsString);
except
on EConvertError do
Fregistro.dtp_fecha_turno.DateTime:=Now;
end;
Fregistro.cb_personal.Text:= FieldByname('TURNADO_A').AsString;
Fregistro.txtinstrucciones.Text:=FieldByname('para').AsString;
Fregistro.widentificador:=1;
exit;
end
else
begin
Fregistro.widentificador:=0;
end;
except
on E:EOleException do
begin
MessageDlg(Format('Error: %s Codigo: %d', [E.Message, E.ErrorCode]), mtError, [mbOK], 0);
exit;
end;
end;
end;
AHORA BIEN ME SIGUE LA DUDA DEL POR QUE NO PUEDO USAR PARAMETROS PARA GENERAR MIS CONSULTAS:
LO QUE PARA UNOS ES FACIL HACER UN SERT DE LA SIGUIENTE MANERA :
Código Delphi
[-] SQL.Clear;
sql.Add('Insert into sap_serv(nombreserv,cuota)');
SQL.Add('Values( :servicio, :cuota)');
Parameters.ParamByName('servicio').Value:=wservicio;
Parameters.ParamByName('cuota').Value:=wcuota;
YO LO TENGO QUE HACER ASI
Código Delphi
[-] sql.Clear;
sql.Add(' insert into sap_contrato (');
Sql.Add(' nocontrato ,'); sql.Add(' nombre ,'); sql.Add(' paterno ,'); sql.Add(' materno ,'); sql.Add(' ncompleto, '); sql.Add(' localidad ,'); sql.Add(' calle ,'); sql.Add(' noext ,'); sql.Add(' noint ,'); sql.Add(' cp ,'); sql.Add(' fecharegistro ,'); sql.Add(' telefono ,'); sql.Add(' observacio, '); sql.add(' status '); sql.Add(' ) values (');
sql.Add(' '+QuotedStr(wnocontrato)+', '); sql.Add(' '+QuotedStr(wnombre)+', '); sql.Add(' '+QuotedStr(wpaterno)+', '); sql.Add(' '+QuotedStr(wmaterno)+', '); sql.Add(' '+QuotedStr(wcompleto)+', '); sql.add(' '+QuotedStr(wlocalidad)+', '); sql.Add(' '+QuotedStr(wcalle)+', '); sql.Add(' '+IntToStr(wnoint)+', '); sql.Add(' '+inttostr(wnoext)+', '); sql.Add(' '+Inttostr(wcp)+', '); sql.Add(' '+QuotedStr(DateToStr(wfechare))+', '); sql.Add(' '+QuotedStr(wtel)+', '); sql.Add(' '+QuotedStr(wobs)+', '); sql.Add(' '+Inttostr(westatus) +')'); ExecSQL;
AHORA LO QUE PREGUNTO ES HAY AKLGUNA EXTRAÑA RAZON DEL PORQUE ALGUNOS PUEDEN USAR PARAMETROS Y OTROS NO, O DEPENDE DE LA BASE DE DATOS O DE LOS COMPOMENTES QUE SE USAN PARA ACCEDER A ELLOS O DE LAS USES.
MIS USES
Código Delphi
[-]uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, Buttons, ComCtrls,ADODB,ComObj,DateUtils;
MIS COMPONENTE SON
ADOCONEXION,ADOQUERY,ADOSTOREPROCEDURE.
Y MI BASE DE DATOS ES
SQLSERVER 2000
CONTRAVENENO, QUE USES TIENES REGISTRADAS, QUE BASE DE DATOS USAS Y QUE COMPONENTES?
ESPERO ME RESPONDAN :-)