From: Juanma f. <pa...@ho...> - 2006-09-11 11:22:47
|
<html><div style='background-color:'><DIV class=RTE> <P>Hi, I send the next message the last week:</P> <P>---------------------------------------------------------------------------------------<BR>I am executing the following query:<BR> <BR>SELECT * FROM HISTPRECONTA <BR>WHERE (FECHALTA IS NULL OR FECHALTA='') <BR>OR FECHALTA IN('20060907') <BR>AND NUMEMP=2<BR>AND CODEMPRESA=1<BR> <BR>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<BR>adapter.SelectCommand=command; <BR>command.CommandText = <BR>"SELECT * FROM HISTPRECONTA <BR>WHERE (FECHALTA IS NULL OR FECHALTA='') <BR>OR FECHALTA IN('20060907') <BR>AND NUMEMP=2<BR>AND CODEMPRESA=1"<BR>ds = new DataSet();<BR>adapter.Fill(ds); //Here the program is locked and the method never returns, no exception is throwed</P> <P>I'm sure that the C# code is ok, I has executed the query with other data and it goes ok.</P> <P>I'm using Firebird Server 1.5 and Firebird Net Provider 1.6<BR>---------------------------------------------------------------------------------------</P> <P>Well, in the table HISTPRECONTA there are 56 records, and the query must return 2. Before executing this query, I do the same<BR>query twice, but with NUMEMP = 0 and NUMEMP = 1, and it go ok, and execution of "adapter.Fill(ds);" is not locked. This is<BR>the C# code of the method, that is called by a foreach loop with diferents values for the parameter "codigoEmpleado":</P> <P>public DataTable obtenerRegistrosHistorico(ConfiguracionBD conf, <BR> ArrayList columnas, <BR> string nombreTabla, <BR> string campoEmpleado, <BR> int codigoEmpleado, <BR> string campoFecha, <BR> string fecha, <BR> string campoEmpresa, <BR> int codEmpresa,<BR> IDbConnection connection, <BR> IDbTransaction transaction) //transaction is passed null<BR>{<BR> <BR> //IDbConnection connection= factoriaConexiones.getConnection(conf);<BR> IDbCommand command= connection.CreateCommand();<BR> command.Transaction=transaction;<BR> IDbDataAdapter adapter= factoriaDataAdapter.getDataAdapter();<BR> DataSet ds = new DataSet();</P> <P> <BR> string cols ="";<BR> if(columnas == null || columnas.Count== 0)<BR> cols ="*";<BR> else<BR> cols = new Cadenas().convertirAString(columnas);</P> <P> command.CommandText="SELECT MAX("+campoFecha+") FROM "+nombreTabla<BR> +" WHERE "+campoEmpleado+"="+codigoEmpleado<BR> +" AND "+campoEmpresa+"="+codEmpresa<BR> +" AND "+campoFecha+" <= '"+fecha+"'";<BR> <BR> try<BR> {<BR> adapter.SelectCommand=command; <BR> adapter.Fill(ds);<BR> DataTable dtFecha = ds.Tables[0];<BR> string maxFecha = dtFecha.Rows[0][0].ToString();<BR> command.CommandText="SELECT "+cols+" FROM "+nombreTabla<BR> +" WHERE (FECHALTA IS NULL OR FECHALTA='') OR" <BR> + campoFecha+" IN('" + maxFecha + "')"<BR> +" AND "+campoEmpleado+"="+codigoEmpleado<BR> +" AND "+campoEmpresa+"="+codEmpresa;<BR> ds = new DataSet();<BR> adapter.Fill(ds); //This is the locked query in the third called of the method <BR> //obtenerRegistrosHistorico<BR> }<BR> catch(Exception e)<BR> {<BR> Excepcion ex= new Excepcion(new Exception("WMNDAC_ErrorBaseDatos",e));<BR> ArrayList exN=new ArrayList();<BR> ArrayList exV=new ArrayList();<BR> exN.Add("conf");exV.Add(conf);<BR> exN.Add("columnas");exV.Add(columnas);<BR> exN.Add("nombreTabla");exV.Add(nombreTabla);<BR> exN.Add("campoEmpleado");exV.Add(campoEmpleado);<BR> exN.Add("codigoEmpleado");exV.Add(codigoEmpleado);<BR> exN.Add("campoFecha");exV.Add(campoFecha);<BR> exN.Add("fecha");exV.Add(fecha);<BR> exN.Add("campoEmpresa");exV.Add(campoEmpresa);<BR> exN.Add("codEmpresa");exV.Add(codEmpresa);<BR> exN.Add("connection");exV.Add(connection);<BR> exN.Add("transaction");exV.Add(transaction);<BR> ex.lanzar(this,ex.formatearParametros("OperadorBD.obtenerRegistrosHistorico",exN,exV),new WMNDACConfiguracion().HacerLogExcepciones);<BR> }</P> <P> return ds.Tables[0];<BR>}</P> <P><BR>Column FECHALTA, can`t be NULL in the table, and it isn't necesary to apply the condition "FECHALTA IS NULL" of the query,<BR>but FECHALTA = '' is really necesary. I tell this because, if I delete the condition "(FECHALTA IS NULL OR FECHALTA='')"<BR>from the query, it goes ok in C# code. If I only delete "FECHALTA IS NULL" or ("FECHALTA = '') the query continues blocking<BR>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<BR>used v1.7 of Firebird Net Provider. </P> <P>I'm don't know english, I'm sorry the errors in my message.</P> <P>Thanks.<BR></P></DIV> <DIV></DIV> <BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #a0c6e5 2px solid; MARGIN-RIGHT: 0px"><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif"> <HR color=#a0c6e5 SIZE=1> <DIV></DIV>From: <I>Carlos Guzmán Álvarez <car...@mu...></I><BR>Reply-To: <I>"For users and developers of the Firebird .NET providers" <fir...@li...></I><BR>To: <I>"For users and developers of the Firebird .NET providers" <fir...@li...></I><BR>Subject: <I>Re: [Firebird-net-provider] (no subject)</I><BR>Date: <I>Fri, 08 Sep 2006 22:27:59 +0200</I><BR>MIME-Version: <I>1.0</I><BR>Received: <I>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</I><BR>Received: <I>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)</I><BR>Received: <I>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 fir...@li...;Fri, 08 Sep 2006 13:27:48 -0700</I><BR>Received: <I>from smtp2.mundo-r.com ([212.51.32.187])by mail.sourceforge.net with esmtp (Exim 4.44) id 1GLmx2-0002Bf-Qifor fir...@li...;Fri, 08 Sep 2006 13:27:49 -0700</I><BR>Received: <I>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</I><BR>>Hello:<BR>> ><BR>> > I'm sure that the C# code is ok, I have execute the query with other<BR>> > data and it go ok.<BR>> ><BR>> > I'm using Firebird Server 1.5 and Firebird Net Provider 1.6<BR>> ><BR>>Can you send a test case ?? What is the isolation level you are using<BR>>for the transactions ( if you are using a non default one ) ??<BR>>Is the same thing happening on v1.7 of the provider ??<BR>><BR>>--<BR>>Carlos Guzmán Álvarez<BR>>Vigo-Spain<BR>><BR>>-------------------------------------------------------------------------<BR>>Using Tomcat but need to do more? Need to support web services, security?<BR>>Get stuff done quickly with pre-integrated technology to make your job easier<BR>>Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo<BR>>http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642<BR>>_______________________________________________<BR>>Firebird-net-provider mailing list<BR>>Fir...@li...<BR>>https://lists.sourceforge.net/lists/listinfo/firebird-net-provider<BR></FONT></BLOCKQUOTE></div></html> |