data-access

Cakephp How to query the paid amount?

梦想与她 提交于 2020-05-09 17:02:51
问题 I dont know whats wrong but my code dont output the paid amount column $payment_tbl = TableRegistry::get("MembershipPayment"); $payments = $payment_tbl->find(); $payments->select(['payment_total'=> $payments->func()->sum('paid_amount')]); $this->set("payments",$payments); and then echo this as echo $payments->payment_total; 回答1: $payments will be a query result object, not a single result. With this query, where you're expecting just a single row, add ->first() after your sum call. In general

Cakephp How to query the paid amount?

寵の児 提交于 2020-05-09 17:01:12
问题 I dont know whats wrong but my code dont output the paid amount column $payment_tbl = TableRegistry::get("MembershipPayment"); $payments = $payment_tbl->find(); $payments->select(['payment_total'=> $payments->func()->sum('paid_amount')]); $this->set("payments",$payments); and then echo this as echo $payments->payment_total; 回答1: $payments will be a query result object, not a single result. With this query, where you're expecting just a single row, add ->first() after your sum call. In general

Generic Data Access functions

倖福魔咒の 提交于 2020-01-03 05:54:07
问题 What is the best way to code the following generic data access functions (ADO.NET, C# or VB, SQLServer or OLEDB) Execute SQL on a connection Open a DataReader Open a DataSet (any ideas on this one?) Such that I can call these functions from anywhere in my program. I'm not interested in Data Access patterns or Data Access layers unless they directly apply to these functions. (i.e. a pattern to automatically close the connection or the reader/dataset) Examples of use ExecuteSQL("UPDATE tblTest

How in .Net do I Import Values from a CSV in the format I want using OleDB?

狂风中的少年 提交于 2019-12-31 01:49:08
问题 I have a CSV file that has a column that contains strings that look like integers. That is they should be dealt with as strings, but since they are numbers they appear to be imported as integers (dropping off the leading zeroes). Example Data: 0000000000079 0000999000012 0001002000005 0004100000007 The problem I'm seeing is that the last example data point comes through as DBNull.Value. I'm assuming this is because OleDB is treating that column as an integer (the data points come through

Solution for “Could not load file or assembly 'Oracle.DataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342' ” required

佐手、 提交于 2019-12-25 02:44:08
问题 I am trying to connect my application to ORACLE 12c but while i run the application specific windows service, getting the below error. Earlier I had both 11g and 12c and the issue appeared. So, I removed both of them and installed fresh 12c. Checked the frameworks folder for the said Oracle.DataAccess File. It is there. Also checked in odp.net folder of oracle installation. File is there with correct version. Can anyone help me out???? Assembly Load Trace: The following information can be

ADO.NET & Oracle error

大憨熊 提交于 2019-12-25 02:09:16
问题 I am getting an error message in a .NET application. I am very new to using Oracle with .NET. The ADO.NET provider with invariant name 'Oracle.DataAccess.Client' is either not registered in the machine or application config file, or could not be loaded. I have installed devart's oracle driver and also oracle instant client from oracle. But getting this error message. Does anyone know how to solve this? 来源: https://stackoverflow.com/questions/29916234/ado-net-oracle-error

Java EE 5 and Hibernate

落花浮王杯 提交于 2019-12-23 21:33:25
问题 Which version of Hibernate can I use with Java EE 5? Can I use the latest version? 回答1: See http://www.hibernate.org/, it says that newest 4.1.4 version can be used with Java EE 5. 回答2: Any. Neither JPA nor Hibernate restrict your choice of application server. They are independent. 来源: https://stackoverflow.com/questions/11441785/java-ee-5-and-hibernate

Where to put restrictions on entities when separating Business layer from Data Layer

不问归期 提交于 2019-12-23 12:35:31
问题 I am attempting to create the the business and data layers for my big ASP.NET MVC application. As this is the first time for me attempting a project of this scale I am reading some books and trying to take good care at separating things out properly. Usually my applications mix the business logic and data access layers, and multiple business entities are intertwined in the single class (which has confused me a few times when I was trying to figure out where to add things). Most of what I have

Oracle.Dataaccess error ORA-06502: PL/SQL: numeric or value error: character string buffer too small

﹥>﹥吖頭↗ 提交于 2019-12-23 11:51:03
问题 I am invoking a stored proc from .NET app. The proc returns an out parameter of type Varchar2. To fet ch the out parameter I am passing the parameter to the command as OracleParameter: parm12 = new OracleParameter("testkey" , OracleDbType.Varchar2 , out2 , ParameterDirection.Output); When I execute the proc I am receiving an error PL/SQL: numeric or value error: character string buffer too small. 回答1: Found the answer. For the OUT parameter i declared the size to max of varchar - 32767 and it

Oracle.Dataaccess error ORA-06502: PL/SQL: numeric or value error: character string buffer too small

馋奶兔 提交于 2019-12-23 11:50:35
问题 I am invoking a stored proc from .NET app. The proc returns an out parameter of type Varchar2. To fet ch the out parameter I am passing the parameter to the command as OracleParameter: parm12 = new OracleParameter("testkey" , OracleDbType.Varchar2 , out2 , ParameterDirection.Output); When I execute the proc I am receiving an error PL/SQL: numeric or value error: character string buffer too small. 回答1: Found the answer. For the OUT parameter i declared the size to max of varchar - 32767 and it