Public Function listadoPedidosVenta(ByVal sql As String) As CCursor
'Recupera un listado de pedidos venta basado en una consulta
Dim rc As CRetrieveCriteria
Dim c As New PedidoVenta
Dim cursor As CCursor
c = New PedidoVenta
rc = New CRetrieveCriteria
rc.ClassMap = c.getClassMap
rc.WhereCondition.addSelectEqualTo("TipoDocumento", sql)
rc.WhereCondition.addSelectEqualTo("CodigoFormaPago", "CodigoFormaPago")
'rc.ReturnFullObjects = True
cursor = rc.perform(c)
Return cursor
End Function
My problem is that i need compare in the sql query: Select ..... from PedidoVenta where ...... and CodigoFormaPago=CodigoFormaEnvio
How do you it?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You can use either the PersistenceBroker.ProcessDirectSql() method or the ProcessPureSql() method (or the ProcessStoredProcedure() method).
The difference between the DirectSql and the PureSql methods is that the PureSql does no pre-processing on the statement and just executes it as it is.
The DirectSql method will convert object.property names to table.column names based on the O/R Mappings.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi
I have a following structure:
<class name="PedidoVenta" table="pedidoventa" database="erp" namespace="Ventas">
<attribute name="CodigoPedidoVenta" column="CodigoPedidoVenta" find="true" key="primary" />
<attribute name="CodigoCliente" column="CodigoCliente" />
<attribute name="Cliente" />
<attribute name="FormaPago"></attribute>
<attribute name="CodigoFormaPago" column="CodigoFormaPago"></attribute>
<attribute name="FormaEnvio"></attribute>
<attribute name="CodigoFormaEnvio" column="CodigoFormaEnvio"></attribute>
<attribute name="TipoEstado"></attribute>
<attribute name="CodigoTipoEstado" column="CodigoTipoEstado"></attribute>
<attribute name="TipoPorte"></attribute>
<attribute name="CodigoTipoPorte" column="CodigoTipoPorte"></attribute>
<attribute name="Almacen"></attribute>
<attribute name="CodigoAlmacen" column="CodigoAlmacen"></attribute>
<attribute name="Numero" column="NumeroPedidoVenta" />
<attribute name="Fecha" column="Fecha" />
<attribute name="Descuento" column="Descuento" />
<attribute name="GastosVarios" column="GastosVarios" />
<attribute name="Bruto" column="Bruto" />
<attribute name="Total" column="Total" />
<attribute name="Porte" column="Porte" />
<attribute name="CodigoDocumentoAsociado" column="CodigoDocumentoAsociado" />
<attribute name="DetallePedidoVenta" />
<!-- <attribute name="DetalleDevolucionVenta"/> -->
<attribute name="FacturasVenta" />
<attribute name="TipoDocumento" column="TipoDocumento" />
<attribute name="CreatedDate" column="CreatedDate" timestamp="true" />
<attribute name="ModifiedDate" column="ModifiedDate" timestamp="true" />
</class>
I have a query :
Public Function listadoPedidosVenta(ByVal sql As String) As CCursor
'Recupera un listado de pedidos venta basado en una consulta
Dim rc As CRetrieveCriteria
Dim c As New PedidoVenta
Dim cursor As CCursor
c = New PedidoVenta
rc = New CRetrieveCriteria
rc.ClassMap = c.getClassMap
rc.WhereCondition.addSelectEqualTo("TipoDocumento", sql)
rc.WhereCondition.addSelectEqualTo("CodigoFormaPago", "CodigoFormaPago")
'rc.ReturnFullObjects = True
cursor = rc.perform(c)
Return cursor
End Function
My problem is that i need compare in the sql query: Select ..... from PedidoVenta where ...... and CodigoFormaPago=CodigoFormaEnvio
How do you it?
Hi Victor,
Good question.
As you know, the where condition SelectEqualTo's make SQL where clauses in the form of "table.column = value".
However there is no method to make where clauses in the form of "table.column1 = table.column2".
We'd have to create a new overridden method to do it.
How can I executed a sql instruction
You can use either the PersistenceBroker.ProcessDirectSql() method or the ProcessPureSql() method (or the ProcessStoredProcedure() method).
The difference between the DirectSql and the PureSql methods is that the PureSql does no pre-processing on the statement and just executes it as it is.
The DirectSql method will convert object.property names to table.column names based on the O/R Mappings.