/[H9]/trunk/tntnet/dynamic/customerlist.ecpp
ViewVC logotype

Annotation of /trunk/tntnet/dynamic/customerlist.ecpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 71 - (hide annotations) (download)
Tue Nov 27 17:08:11 2007 UTC (16 years, 6 months ago) by torben
File size: 1013 byte(s)
Getting closer towards a working solution :)

1 torben 71 <%pre>
2     #include <tntdb/connect.h>
3     #include <tntdb/connection.h>
4     #include <tntdb/result.h>
5     #include <tntdb/row.h>
6    
7     #include "common.h"
8     </%pre>
9    
10     <%config>
11     dburl;
12     </%config>
13    
14     <&header title="Critical systems">
15     </&header>
16    
17     <h2>Customers and installations</h2>
18    
19     <{
20     tntdb::Connection conn;
21    
22     conn = tntdb::connect(dburl); //letting exceptions flow up and to tntnet and let it display an error message
23    
24     std::string customer_sql = "SELECT id,name,address,phonenr,contactperson FROM customer ORDER BY name ASC";
25    
26     tntdb::Result res = conn.select(customer_sql);
27    
28     std::ostream& out = reply.out();
29    
30     if (res.size() != 0)
31     {
32     for (tntdb::Result::const_iterator it = res.begin(); it != res.end(); ++it)
33     {
34     tntdb::Row row = *it;
35     out << "<table border=1 width=80% cellspacing=0 align=center><tr><td>";
36     out << "<b>" << row.getString(1) << "</b><br>\n\n";
37    
38    
39     out << nl2br(row.getString(2)) << "<br>\n";
40    
41    
42     out << "</td></tr></table><br>\n";
43    
44     }
45     }
46     else
47     {
48     out << "<i>No customer records found!</i>";
49     }
50    
51     }>
52    
53     <&footer>
54     </&footer>

  ViewVC Help
Powered by ViewVC 1.1.20