datasource

DataTextField in a ListBox is a combination of 2 fields

允我心安 提交于 2019-12-08 02:55:51
问题 I have a listbox containing Users. The datasource is an generic list of the type User (contains, id, firstname, lastname, ...). Now I want to use the id as datavalue (through dataValueField) and I want LastName + ' ' + Firstname as a DataTextField. Can anyone tell me how this is possible? I'm using C# (ASP.NET). 回答1: The easiest way is to add a new property to the User class that contains the full name: public string FullName { get { return LastName + " " + FirstName; } } And bind the listbox

Populating a programatically declared datagridview using datasource and entity framework

孤街醉人 提交于 2019-12-08 02:53:26
问题 just having some small issues with c# winforms datagridview. Here's my scenario I am using entity framework and am trying to bind certain entity models to my datagridview datasource. var query = from q in context.foo select q; dgv_Disp.DataSource = query.ToList(); When I ran this piece of code above on a form class which had a datagridview in the GUI, it all worked fine. The datagridview will automatically generate columns and the number of rows. But when I run this exact same code with the

Each request from user call a new getConnection()?

拈花ヽ惹草 提交于 2019-12-08 02:13:16
问题 The database connection is get like below public Connection getDBConection(){ Context context = new InitialContext(); DataSource dataSource = (javax.sql.DataSource) context.lookup("java:myDataSource"); Connection conn = dataSource.getConnection(); } For a userA, is each database request should call getDBConnection() once; but no need to control all request use the same connection? That is, if userA has three database request, then userA should call getDBConnection() three times, and call

Filling reports from json using JasperReports [duplicate]

假装没事ソ 提交于 2019-12-07 22:46:29
问题 This question already has answers here : How to fill report using JSON datasource without getting null values? (3 answers) Closed 3 years ago . I'm beginner with JasperReports ( first try ) so, I set up my netbeans, and my first try using data from database was successful. But now I just want to create my report from json data using Jasper Reports in Netbeans And I think it's not like getting data from Database. By the way I tried to edit my xml file and add this : <textField> <reportElement

Switching DataSources in ReportViewer in WinForms

匆匆过客 提交于 2019-12-07 17:18:40
问题 I have created a winform for the users to view view the many reports I am creating for them. I have a drop down list with the report name which triggers the appropriate fields to display the parameters. Once those are filled, they press Submit and the report appears. This works the first time they hit the screen. They can change the parameters and the ReportViewer works fine. Change to a different report, and the I get the following ReportViewer error: An error occurred during local report

MS Charts C# DataSource from array or List

谁都会走 提交于 2019-12-07 13:17:05
问题 i want to fill the data of the charts from values i have in 2D array, one column will present the X-axis and the second is present the Y-axis.. i did it, but its not reading from the array, it gives me the default line when i run the application, i found a solution using List<>, i had an error, so if any one could help me in this, i will be thankful :D this is the code using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using

Creating HibernateTemplate by org.springframework.orm.hibernate4.LocalSessionFactoryBean

十年热恋 提交于 2019-12-07 13:16:48
问题 I work with Spring 3.1 + Hibernate 4. I've created the following sessionFactory : <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"> <property name="dataSource" ref="myDataSource" /> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.hbm2ddl.auto">validate</prop> </props> </property> <property name="packagesToScan"

BIRT does not show base64 encoded image

天涯浪子 提交于 2019-12-07 12:25:38
问题 I want to include images into a BIRT report. The images shall be given by a XML data source (base64 encoded). But the XML data source does not support the Blob data type. I found a nice answer in this BIRT question where the base64 encoded image data is included as URI ( data:image/png;base64,...BASE64DATA... ). So I tried myself with a small static example but BIRT (4.4.2) does not show the image. Firefox displays the image when I paste the URI into the address bar. Here is a small static

Getting null pointer exception @Resource annotation in tomcat 7

╄→尐↘猪︶ㄣ 提交于 2019-12-07 10:48:53
问题 Here is my Resource element in context.xml :: <Resource name="jdbc/myoracle" auth="Container" type="javax.sql.DataSource" driverClassName="oracle.jdbc.driver.OracleDriver" url="jdbc:oracle:thin:@localhost:1521:XE" username="hr" password="hr" maxActive="20" maxIdle="10" maxWait="-1"/> Here is my Resource reference in web.xml: <resource-ref> <description>Oracle Datasource</description> <res-ref-name>jdbc/myoracle</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res

Can I use one pooled datasource for multiple databases with Spring/Hibernate/c3p0?

笑着哭i 提交于 2019-12-07 10:45:21
问题 Our application uses Spring/Hibernate for database access. We use multiple hibernate session factories ( hibernate3.LocalSessionFactoryBean ), because the data is in a number of separate databases. Each session factory is configured with a pooled datasource using c3p0 ( c3p0.ComboPooledDataSource ). As it happens, the databases all reside on the same db server. Our issue is that we end up with a number of db connection pools, all connecting into the same server. Is there any way of sharing