on 12-03-2014 9:31 AM
Hi All,
Can Any one tell me how to retrieve the multiple records based on given inputs from hana data base table through XSJS application.
Thanks & Regards,
Hemanth Reddy M.
Here is a quick and dirty example where TCURR table of saphea is being read and displayed in a html table.
Hope this gives you a basic idea of mutirecord resultset. You may enhance it further.
to test you can point some different table which has less number of records because I have not given any where clause.
========================
$.response.contentType = "text/html";
var output = "Hello User, " + $.session.getUsername() + " <br><br>";
var conn = $.db.getConnection();
var pstmt = conn.prepareStatement( "SELECT * FROM saphea.TCURR" );
var rs = pstmt.executeQuery();
var meta = rs.getMetaData();
var i=1;
var colCount = meta.getColumnCount();
var colName = 1;
output = output + "<table border=\"1\"><tr>";
// displays Column Name of TCURR table
for (i=1; i<= colCount ; i++){
output = output + "<td>" + meta.getColumnName(i) + "</td>";
}
output = output + "</tr>";
// displays Data of TCURR table
while(rs.next())
{
output=output+"<tr>";
for ( i = 1; i<= colCount ; i++){
output = output + "<td>" + rs.getString(i) + "</td>";
}
output=output+"</tr>";
}
output = output + "</table>";
rs.close();
pstmt.close();
conn.close();
$.response.setBody(output);
Sample Output:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI All ,
Can any please help me in this.
Thanks & Regards,
Hemanth Reddy M.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.