Ver Mensaje Individual
  #6  
Antiguo 07-09-2010
Avatar de microbiano
microbiano microbiano is offline
Miembro
 
Registrado: sep 2008
Ubicación: Mexico D.F
Posts: 349
Reputación: 18
microbiano Va por buen camino
Talking Listo Resuelto El Problema

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);
        {registros de distribucion y verifico que no me traiga una
        fecha vacio si es asi le pongo la fecha actual}
        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;
        {termina registros de distribucion}
        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 ,');    //1
     sql.Add(' nombre ,');//2
     sql.Add(' paterno ,');//3
     sql.Add(' materno ,');//4
     sql.Add(' ncompleto, '); //5
     sql.Add(' localidad ,');//6
     sql.Add(' calle ,');//7
     sql.Add(' noext ,');//8
     sql.Add(' noint ,');//9
     sql.Add(' cp ,');//10
     sql.Add(' fecharegistro ,');//111
     sql.Add(' telefono ,');//12
     sql.Add(' observacio, ');//13
     sql.add(' status ');//14
     sql.Add(' ) values (');
     sql.Add(' '+QuotedStr(wnocontrato)+', ');//1
     sql.Add(' '+QuotedStr(wnombre)+', ');//2
     sql.Add(' '+QuotedStr(wpaterno)+', ');//3
     sql.Add(' '+QuotedStr(wmaterno)+', ');//4
     sql.Add(' '+QuotedStr(wcompleto)+', '); //5
     sql.add(' '+QuotedStr(wlocalidad)+', ');//6
     sql.Add(' '+QuotedStr(wcalle)+', ');//7
     sql.Add(' '+IntToStr(wnoint)+', ');//8
     sql.Add(' '+inttostr(wnoext)+', ');//9
     sql.Add(' '+Inttostr(wcp)+', '); //10
     sql.Add(' '+QuotedStr(DateToStr(wfechare))+', ');//11
     sql.Add(' '+QuotedStr(wtel)+', ');//12
     sql.Add(' '+QuotedStr(wobs)+', ');//13
     sql.Add(' '+Inttostr(westatus) +')');//14
      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 :-)

Última edición por microbiano fecha: 07-09-2010 a las 17:24:42. Razón: modificar el mensaje
Responder Con Cita