BBJSP SQL:Query Tag (Deprecated)

The BBJSP system is deprecated. For new development, use BBxServlet.

Description

In BBj 16.0 and higher, this tag can be used in a BBJSP Page to execute an SQL query.

Attributes

Attribute Name

Description

Required

Expression

Data Type

datasource

The name of the database.

false

false

String

recs

The number of records to load.

false

true

int

sql

The SQL query statement

true

true

String

template

The name-bound variable to use to store the record template.

false

false

String

var

The name-bound variable to use to store the results

true

false

String

Remarks

None.

Example

<!DOCTYPE html/>
<%@ taglib uri='/WEB-CFG/tld/core.tld' prefix='c' %>
<%@ taglib uri='/WEB-CFG/tld/sql.tld' prefix='sql' %>
<!-- Demo of executing an SQL query -->
<html>
<head>
<title>SQL Tags</title>
</head>
<body>
<sql:query template='tpl' var='result' datasource='ChileCompany' sql='SELECT * FROM SALESREP' />

<table width='100%'>
<c:iterate data="${result}" id="item" >
<c:template id='theRecord' template='${tpl}' data='${item}' /> 
<tr>
<td>${theRecord['SALESPERSON']}</td>
<td class='l'>${theRecord['NAME']}</td>
<td class='l'>${theRecord['ADDRESS']} ${theRecord['ADDRESS2']}</td>
<td>${theRecord['CITY']}</td>
<td>${theRecord['STATE']}</td>
<td>${theRecord['ZIP']}</td>
<td class='l'>${theRecord['PHONE']}</td>
</tr> 
</c:iterate>
</table>
</body>
</html>

See Also

BBJSP

SQLTags

<SQL.Param>