Ver Mensaje Individual
  #20  
Antiguo 28-07-2010
Avatar de richy08
richy08 richy08 is offline
Miembro
 
Registrado: may 2007
Ubicación: Bucerias, Nayarit Mexico
Posts: 529
Reputación: 20
richy08 Va por buen camino
Buenas tardes manuc he estado reajustando el codigo con los ejemplos que me has dado pero me saltan algunos errores que no he conseguido resolverlos

1. el primero es al crear la clase en la linea de destructor Destroy;
Código Delphi [-]
tmisComponentes=Class(tPersistent)
  private
   fConexionADO:TADOConnection;
   fQueryADO:TAdoQuery;
   fConexionZ:TZConnection;
   fQueryZ:TZQuery;
  Public  
   destructor Destroy; 
   property Conexion:TADOConnection read fConexionADO write fConexionADO;
   property Query:TAdoQuery read fQueryADO write fQueryADO;
   property Conexion1:TZConnection read fConexionZ write fConexionZ;
   property Query1:TZQuery read fQueryZ write fQueryZ;
  end;
[Error] Interfaces.pas(47): Unsatisfied forward or external declaration: 'tmisComponentes.Destroy', al comentarla el programa corre pero no se s iesto me desencadena algunos otros errores


2.-al querer asignarle al componente "conexion" la cadena de conexion que fue creada en el evento formcreate

Código Delphi [-]
procedure TFrm_Interfaces.FormCreate(Sender: TObject);
begin
  Clients := TThreadList.Create;
   cadena:='Provider=SQLOLEDB.1;Password=Siti2009;Persist Security Info=True;User ID=sa;Initial Catalog=PMS;Data Source=SITISERVER08\SITISQL_05; ';
  cadena:=cadena+' Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=DESARROLLO;Use Encryption for Data=False;Tag with column collation when possible=False';
  CBServerActive.Checked:=true;
end;


al querer asignarle la cadena en el evento serverexecute MisComponentes.Conexion.ConnectionString:=cadena;


Código Delphi [-]
procedure TFrm_Interfaces.ServerExecute(AThread: TIdPeerThread);
var
  ActClient, RecClient: PClient;                                                                              
  CommBlock, NewCommBlock: TCommBlock;
  RecThread: TIdPeerThread;
  i, seleccion: Integer;
  MisComponentes:tmisComponentes;
begin
  if not AThread.Terminated and AThread.Connection.Connected then
  begin
    AThread.Connection.ReadBuffer (CommBlock, SizeOf (CommBlock));
    ActClient := PClient(AThread.Data);
    ActClient.LastAction := Now;  // update the time of last action
    MisComponentes :=  tmisComponentes(AThread.Data);
    //conneccionMSSQL
    MisComponentes.Conexion.ConnectionString:=cadena;
    MisComponentes.Conexion.loginprompt:=false;
    MisComponentes.Conexion.provider:='SQLOLEDB.1';
    MisComponentes.Conexion.connected;
    //conneccionMSSQL
    //conneccionMysql
    MisComponentes.Conexion1.Catalog:= 'lookup';
    MisComponentes.Conexion1.Database:= 'cdr';
    MisComponentes.Conexion1.HostName:= '192.168.10.3';
    MisComponentes.Conexion1.Password:= 'siti270';
    MisComponentes.Conexion1.Protocol:= 'mysql-5';
    MisComponentes.Conexion1.port:= 3306;
    MisComponentes.Conexion1.User:= 'root';
    MisComponentes.Conexion1.connect; 
    //conneccionMysql
    //queryMssql
    MisComponentes.Query.Close;
    MisComponentes.Query.Connection:= MisComponentes.Conexion;
    MisComponentes.Query.SQL.Text:='select idext, DesTel from pbx_ext where acode=:acode';
    MisComponentes.Query.parameters.ParamByName('acode').Value:=CommBlock.acode;
    MisComponentes.Query.cursorType := ctStatic;
    MisComponentes.Query.open;
    //queryMssql
    //queryMysql
     MisComponentes.Query1.Connection:=MisComponentes.Conexion1;
     MisComponentes.Query1.SQL.Text:='update lookup set  allowcalls=:allowcalls, ldesc=:ldesc where code=:code ';
    //queryMysql

    //ejecuta abrir y cerrar lineas
     i:=0;
     seleccion:=Query.RecordCount;
     MisComponentes.Query.First;
     While ido
     begin
        MisComponentes.Query1.Close;
        MisComponentes.Query1.ParamByName('allowcalls').Value:=CommBlock.estado;
        MisComponentes.Query1.ParamByName('ldesc').Value:=CommBlock.nombre;
        MisComponentes.Query1.ParamByName('code').Value:=MisComponentes.Query1.fieldbyname('idext').Value;
        MisComponentes.Query1.ExecSQL;
        i:=i+1;
        MisComponentes.Query.Next;
     end;
    //ejecuta abrir y cerrar lineas
    Protocol.Lines.Add (TimeToStr(Time)+' The process for '+CommBlock.MyUserName+' was done ');// # Confirm'+inttostr(CommBlock.nconf));
    NewCommBlock.Command := 'DIALOG';       // the message should popup on the client's screen
    NewCommBlock.MyUserName := '[PBX Server]';  // the server's username
    NewCommBlock.Msg := 'The process was done  ';  // the message to show
    NewCommBlock.ReceiverName := '[return-to-sender]'; // unnecessary
    AThread.Connection.WriteBuffer (NewCommBlock, SizeOf (NewCommBlock), true);  // and there it goes...
  end;
end;

el error que envia es Project interfacesP.exe raised exception class EAccessViolation with message 'Access violation at address 00000000. Read of address 00000000'. Process stopped. Use Step or Run to continue.

alguna idea de que pueda ser mil gracias
Responder Con Cita