Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > Pro JSP
|
Pro JSP Advanced JSP coding questions. Beginning questions will be redirected to the Beginning JSP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro JSP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 5th, 2004, 03:34 PM
Registered User
 
Join Date: May 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to barddzen
Default SQL result returns nothing, but empty == false?

Hello,

Been trying to work with JSTL resultsets and for some reason, the variables evlauate to not empty, but the resulset returns no records.

Not idea why...

<sql:setDataSource
      driver="com.microsoft.jdbc.sqlserver.SQLServerDriv er"
      url="jdbc:microsoft:sqlserver://orion:1433"
      user="web"
      password="web"
      var="dataSource" />

<sql:query var="banner" dataSource="${dataSource}">
    SELECT TOP 1 [PublishDate],[FileName]
    FROM [dbo].[1071_f_IntranetDocs]
    WHERE (getDate() >= PublishDate) AND (getDate() <= ExpDate) AND WebFolder = 'VC'
    ORDER BY PublishDate desc
</sql:query>

<c:out value="${banner == null}"/>
<c:out value="${empty banner}"/>

Both of these c:out return false, meaning, the resultset is not empty and not == null, but I'm 100% that the query doesn't return any records.

So what am I to do to detect if no records wre returned?
 
Old August 9th, 2004, 12:52 AM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 345
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to gokul_blr Send a message via Yahoo to gokul_blr
Default

put in the While loop & try

while (rsltset.next())
{
<c:out value="${banner == null}"/>
<c:out value="${empty banner}"/>

}






Similar Threads
Thread Thread Starter Forum Replies Last Post
Illegal operation on empty result set. amisrivas JSP Basics 2 February 19th, 2008 11:49 PM
GridView and SQL More than one result = one result DarkForce ASP.NET 2.0 Basics 0 July 20th, 2007 04:29 AM
SQL Query returns error Raphasevilla Access VBA 2 February 22nd, 2006 08:30 AM
rs.eof returns false hastikeyvan Dreamweaver (all versions) 3 February 4th, 2006 11:08 AM
SQL "Last" instruction returns wrong value rjp Access VBA 0 August 31st, 2004 10:19 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.