User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP section within the Web Development category of DaniWeb, a massive community of 397,836 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,548 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP advertiser: Lunarpages ASP Web Hosting

SQL query problem with WHERE clause

Join Date: Aug 2006
Posts: 2
Reputation: prophet224 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
prophet224 prophet224 is offline Offline
Newbie Poster

Help SQL query problem with WHERE clause

  #1  
Aug 28th, 2006
Hello, this is my first post, so thank you in advance for any help you may be able to give!

I have an ASP page that I need to have pull some information from a SQL table and display. The query in question is very simple:
rs.open "SELECT  UID2, EntryDate, EntryAgent FROM tb_LeadBox WHERE UID2 = '1258753'" 

If I view the page with this query, I get a blank page with no header, and not even the column names in the display table.

If I then remove the WHERE clause so that the query is:
rs.open "SELECT  UID2, EntryDate, EntryAgent FROM tb_LeadBox" 

then the query runs, the page runs, and displays the result set.

I have also tried rs.Filter = "UID2 = '1258753'" with the exact same result, a blank page.

Looking at the source code, the table shows the first result, but again, nothing actually displays. This fact, along with the fact that the query works in SQL Query Analyzer, indicates to me that it isn't a problem with the query, but with how ASP is handling it. Any help? Additional source is below. Thank you all very much!

<% 
DIM CONN,RS 
DIM SSQL 
DIM SORDER 
dim qCallGroupFilter 
 
userid = request.servervariables("LOGON_user") 
 
DBOPEN 
%> 
 
<CENTER><B><FONT size=5 color="black">Data Entry Lead Count 
For Call Group: <%response.write qCallGroupFilter%></FONT></B></CENTER> 
<CENTER><B><FONT size=5 color="black">Last Updated: <%RESPONSE.WRITE SLASTUPDATE%></font></b> </center> 
 
<button onClick="lockCol('tbl')"  id="toggle">Lock Name Column</button> 
<div id="tbl-container"> 
<table id="tbl" border=1 align=center cellpadding=0 cellspacing=0 width=100%> 
<thead><tr><th align=center>Count</th><th align=center>Entry Agent</th><th align=center>Entry Date</th><th align=center>User ID</th></tr></thead> 
 
<% 
dim cnt 
dim strSQL 
dim strWhere 
dim SStr 
cnt=1 
set RS.ActiveConnection = CONN 
rs.open "SELECT  UID2, EntryDate, EntryAgent FROM tb_LeadBox WHERE UID2 = '1258753'"   
 
do while not rs.eof 
 
%> 
 
 <TR> 
     <TD id=r<%=rs("EntryAgent")%>c0 align=center><%= cnt %> 
     </TD> 
     <TD id=r<%=rs("EntryAgent")%>c1 align=center><%=rs("EntryAgent")%> 
     </TD> 
     <TD  id=name_c2 c2 align=left><%=rs("EntryDate")%> 
     </TD> 
     <TD id=r<%=rs("UID2")%>c1 align=center><%=rs("UID2")%> 
     </TD> 
 </TR><%     
 cnt=cnt+1 
 RS.MOVENEXT 
LOOP 
%> 
</table>     
</div> <!-- end tbl-container --> 
 
Optimized for Resolutions 1024x768 and above. 
 
<% 
dbclose 
AddThis Social Bookmark Button
Reply With Quote  
All times are GMT -4. The time now is 7:34 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC