Read and respond to this message at: 
https://sourceforge.net/forum/message.php?msg_id=3048863
By: swafnir

Hi again, 

I just switched to DynaBeans, but somehow my columns are mixed and are totally
out of order.
I wanted to dynamically build a table based on the chosen table view and didn't
find an easy way to accomplish this, because I have to add one column per row
with a hyperlink to allow easy editing. After some failed tries I decided to
read the metadata from the recordset and use the extracted column names in my
<display:column> tags - but my first try showed me that the columns where 
totally
mixed!
Could you take a look and tell me where to find the error causing this 
behaviour?
Thank you!

[CODE]
<%
strQuery = "SELECT Use_Code, BI_number_BTC FROM viewFachbetreuer WHERE 
BI_number_BTC
<> ' '";
// I switched the column names but the table's column order was still the same
(BI_number_BTC, then Use_Code)
        
        DriverManager.registerDriver(new net.sourceforge.jtds.jdbc.Driver());
        conn = 
DriverManager.getConnection("jdbc:jtds:sqlserver://192.168.141.2:1433/th
irdparty", "sa", "ACME");
        Statement stmt = conn.createStatement();
        ResultSet rs = stmt.executeQuery(strQuery);
                        
        // Resultset in DynaBean �bertragen und als session-Objekt verankern
        RowSetDynaClass resultSet = new RowSetDynaClass(rs, false);
        session.setAttribute("results", resultSet);
                        
        // Anzahl Spalten ermitteln und als session-Variable abspeichern
        ResultSetMetaData meta = rs.getMetaData();
        int columns = meta.getColumnCount();
                        
        String strField = meta.getColumnName(1).toString(); 
        session.setAttribute("strField", strField);
                
        session.setAttribute("meta", meta);                     
        session.setAttribute("intColumns", new Integer(columns));
%>
<display:table name="sessionScope.results.rows" export="true">
</display:table>
[/CODE]

______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit: 
https://sourceforge.net/forum/unmonitor.php?forum_id=249318


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
displaytag-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/displaytag-user

Reply via email to