Hi, I send the next message the last week:

---------------------------------------------------------------------------------------
I am executing the following query:
 
SELECT * FROM HISTPRECONTA
WHERE (FECHALTA IS NULL OR FECHALTA='')
OR FECHALTA IN('20060907')
AND NUMEMP=2
AND CODEMPRESA=1
 
When I do the query with SQL Manager 2005 Lite for Interbase and Firebird, it go well. But when I execute the query from this C# code, the dataset never is filled, and the program execution is locked, in other words, the method adapter.Fill(ds) never terminates
adapter.SelectCommand=command;
command.CommandText =
"SELECT * FROM HISTPRECONTA
WHERE (FECHALTA IS NULL OR FECHALTA='')
OR FECHALTA IN('20060907')
AND NUMEMP=2
AND CODEMPRESA=1"
ds = new DataSet();
adapter.Fill(ds); //Here the program is locked and the method never returns, no exception is throwed

I'm sure that the C# code is ok, I has executed the query with other data and it goes ok.

I'm using Firebird Server 1.5 and Firebird Net Provider 1.6
---------------------------------------------------------------------------------------

Well, in the table HISTPRECONTA there are 56 records, and the query must return 2. Before executing this query, I do the same
query twice, but with NUMEMP = 0 and NUMEMP = 1, and it go ok, and execution of "adapter.Fill(ds);" is not locked. This is
the C# code of the method, that is called by a foreach loop with diferents values for the parameter "codigoEmpleado":

public DataTable obtenerRegistrosHistorico(ConfiguracionBD conf,
        ArrayList columnas,
                                           string nombreTabla,
        string campoEmpleado,  
        int codigoEmpleado,
        string campoFecha,
        string fecha,
        string campoEmpresa,
        int codEmpresa,
        IDbConnection connection,  
        IDbTransaction transaction) //transaction is passed null
{
  
 //IDbConnection connection= factoriaConexiones.getConnection(conf);
 IDbCommand command= connection.CreateCommand();
 command.Transaction=transaction;
 IDbDataAdapter adapter= factoriaDataAdapter.getDataAdapter();
 DataSet ds = new DataSet();

   
 string cols ="";
 if(columnas == null || columnas.Count== 0)
  cols ="*";
 else
  cols = new Cadenas().convertirAString(columnas);

 command.CommandText="SELECT MAX("+campoFecha+") FROM "+nombreTabla
    +" WHERE "+campoEmpleado+"="+codigoEmpleado
    +" AND "+campoEmpresa+"="+codEmpresa
    +" AND "+campoFecha+" <= '"+fecha+"'";
  
 try
 {
        adapter.SelectCommand=command; 
 adapter.Fill(ds);
        DataTable dtFecha = ds.Tables[0];
        string maxFecha = dtFecha.Rows[0][0].ToString();
        command.CommandText="SELECT "+cols+" FROM "+nombreTabla
          +" WHERE (FECHALTA IS NULL OR FECHALTA='') OR"
          +  campoFecha+" IN('" + maxFecha + "')"
          +" AND "+campoEmpleado+"="+codigoEmpleado
          +" AND "+campoEmpresa+"="+codEmpresa;
        ds = new DataSet();
        adapter.Fill(ds); //This is the locked query in the third called of the method
     //obtenerRegistrosHistorico
 }
 catch(Exception e)
 {
  Excepcion ex= new Excepcion(new Exception("WMNDAC_ErrorBaseDatos",e));
  ArrayList exN=new ArrayList();
  ArrayList exV=new ArrayList();
  exN.Add("conf");exV.Add(conf);
  exN.Add("columnas");exV.Add(columnas);
  exN.Add("nombreTabla");exV.Add(nombreTabla);
  exN.Add("campoEmpleado");exV.Add(campoEmpleado);
  exN.Add("codigoEmpleado");exV.Add(codigoEmpleado);
  exN.Add("campoFecha");exV.Add(campoFecha);
  exN.Add("fecha");exV.Add(fecha);
  exN.Add("campoEmpresa");exV.Add(campoEmpresa);
  exN.Add("codEmpresa");exV.Add(codEmpresa);
  exN.Add("connection");exV.Add(connection);
  exN.Add("transaction");exV.Add(transaction);
  ex.lanzar(this,ex.formatearParametros("OperadorBD.obtenerRegistrosHistorico",exN,exV),new WMNDACConfiguracion().HacerLogExcepciones);
 }

 return ds.Tables[0];
}


Column FECHALTA, can`t be NULL in the table, and it isn't necesary to apply the condition "FECHALTA IS NULL" of the query,
but FECHALTA = '' is really necesary. I tell this because, if I delete the condition "(FECHALTA IS NULL OR FECHALTA='')"
from the query, it goes ok in C# code. If I only delete "FECHALTA IS NULL" or ("FECHALTA = '') the query continues blocking
when it is called 3 times. I don't Know what is happening. The transaction property of the object command is null. I've never
used v1.7 of Firebird Net Provider.

I'm don't know english, I'm sorry the errors in my message.

Thanks.


From:  Carlos Guzmán Álvarez <[EMAIL PROTECTED]>
Reply-To:  "For users and developers of the Firebird .NET providers" <[email protected]>
To:  "For users and developers of the Firebird .NET providers" <[email protected]>
Subject:  Re: [Firebird-net-provider] (no subject)
Date:  Fri, 08 Sep 2006 22:27:59 +0200
MIME-Version:  1.0
Received:  from lists-outbound.sourceforge.net ([66.35.250.225]) by bay0-mc11-f1.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.2444); Fri, 8 Sep 2006 13:27:51 -0700
Received:  from sc8-sf-list2-new.sourceforge.net (unknown [10.3.1.94])by sc8-sf-spam2.sourceforge.net (Postfix) with ESMTPid E0F8F12DBF; Fri, 8 Sep 2006 13:27:50 -0700 (PDT)
Received:  from sc8-sf-mx2-b.sourceforge.net ([10.3.1.92]helo=mail.sourceforge.net)by sc8-sf-list2-new.sourceforge.net with esmtp (Exim 4.43)id 1GLmx2-0003RW-O3 for [email protected];Fri, 08 Sep 2006 13:27:48 -0700
Received:  from smtp2.mundo-r.com ([212.51.32.187])by mail.sourceforge.net with esmtp (Exim 4.44) id 1GLmx2-0002Bf-Qifor [email protected];Fri, 08 Sep 2006 13:27:49 -0700
Received:  from cm172154.red.mundo-r.com (HELO [213.60.172.154])([213.60.172.154])by smtp2.mundo-r.com with ESMTP; 08 Sep 2006 22:27:46 +0200
>Hello:
> >
> > I'm sure that the C# code is ok, I have execute the query with other
> > data and it go ok.
> >
> > I'm using Firebird Server 1.5 and Firebird Net Provider 1.6
> >
>Can you send a test case ?? What is the isolation level you are using
>for the transactions ( if you are using a non default one ) ??
>Is the same thing happening on v1.7 of the provider ??
>
>--
>Carlos Guzmán Álvarez
>Vigo-Spain
>
>-------------------------------------------------------------------------
>Using Tomcat but need to do more? Need to support web services, security?
>Get stuff done quickly with pre-integrated technology to make your job easier
>Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
>http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
>_______________________________________________
>Firebird-net-provider mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/firebird-net-provider
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Firebird-net-provider mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to