SQL Query

G

Guest

Hi,

I have an ASP page, where I am using the following SQL query:
SELECT * FROM Table_name WHERE (Customer LIKE '::Customer::%' AND State
LIKE 'Cleared%')
and this query works fine...

and now if i change the same to

SELECT * FROM Table_name WHERE (Customer LIKE '::Customer::%' AND State
LIKE 'Cleared%' AND 'TDC' LIKE 'A12%' )
it displays no results at all, not sure what I am doing wrong??? TDC is the
valid field in database...so not sure why it's not working...
any help will be greatly appreciated!!!

Thanks,

Shikha

Thanks,

Shikha
 
T

Thomas A. Rowe

SELECT * FROM Table_name WHERE (Customer LIKE '::Customer::%' AND State
LIKE 'Cleared%' AND TDC LIKE 'A12%' )
--
==============================================
Thomas A. Rowe
Microsoft MVP - FrontPage

http://www.Ecom-Data.com
==============================================
 
G

Guest

Hi Thomas,

Thank you so much for your help, the query itself works when i hit search
now :) The only issue i am having is, when I go to that ASP page, prior to me
even hitting Search it shows me all the results that are in cleared status.
and once i am on the page, and i hit search, it shows me right results then...

Any solution to this problem?

Thanks once again for your help!!!!

Truly appreicate it!

Shikha
 
T

Thomas A. Rowe

There is a solution, however I don't recall what it is, can you post the entire script section of
the search page?
--
==============================================
Thomas A. Rowe
Microsoft MVP - FrontPage

http://www.Ecom-Data.com
==============================================
 
G

Guest

Hi Thomas,

Here is the script section:

<% @language="vbscript" %>
<!--#include file="./fpdb/logonisp.inc"-->
<html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:blush:="urn:schemas-microsoft-com:blush:ffice:blush:ffice"
xmlns="http://www.w3.org/TR/REC-html40">

<head>
<% ' FP_ASP -- ASP Automatically generated by a Frontpage Component. Do not
Edit.
FP_LCID = 4105 %>
<meta http-equiv="Content-Language" content="en-ca">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<% ' FP_ASP -- ASP Automatically generated by a Frontpage Component. Do not
Edit.
FP_CharSet = "windows-1252"
FP_CodePage = 1252 %>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Trouble</title>
<meta name="Microsoft Theme" content="balance 011">
</head>

<body>

<div style="border-style: solid; border-color: #DCF0FE; width:1150;
height:423">
<form BOTID="0" METHOD="POST" ACTION="G12copy.asp">
<p><font color="#DCF0FE">
<img src="19961106-bell.jpg" border="0" width="97" height="63"
align="left"></font></p>
<p><font color="#DCF0FE">
<u><a href="searchisp.asp"><font color="#DCF0FE">Search</font></a></u>
| <a href="openactive.asp"><font color="#DCF0FE">Open Active</font></a> |
</font>
<a href="closed.asp"><font color="#DCF0FE">
<a href="closed.asp"><font
color="#DCF0FE">Closed</font></a></font></a><font color="#DCF0FE"><a
href="closed.asp"><font color="#DCF0FE">
</font></a>| <a href="clear.asp"><font
color="#DCF0FE">Clear</font><u><font color="#DCF0FE">ed</font></u></a> | <a
href="Logout.asp"><font color="#DCF0FE"> <u>
Log Out</u></font></a></font><br>
<font
color="#DCF0FE">
<a href="G13.asp"><font color="#DCF0FE">Not
In Sync </font></a>| <a href="G12.asp" style="text-decoration:
none"><font color="#DCF0FE">In Sync Tests Ok</font></a>
</font>
</p>
<p><font color="#DCF0FE
</font>
<b>
<font color="#DCF0FE">
</font>
<a target="_blank" href="glossaryall.htm"><font
color="#DCF0FE">Glossary</font></a></b></p>
<p> </p>
<div align="center">
<center>
<table BORDER="0" style="border-collapse: collapse" cellpadding="0"
cellspacing="0">
<tr>
<td>
<p align="center"><b>Customer: </b></td>
<td><font color="#DCF0FE">
<input NAME="Customer" VALUE="<% =Session("UID") %>" readonly =
"readonly" size="23" style="color: #DCF0FE; font-family: Trebuchet MS;
font-size: 12pt; border: 1px solid #000066; background-color:
#000064"></font></td>
</tr>
</table></center>
</div>
<blockquote>

<p align="center">
</p>

<p align="center">
<input TYPE="submit" value="Search"></p>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
<p> </p>
</form>
<table width="1200" border="1">
<thead>
<tr>
<td width="97"><b><font size="2">Trouble #</font></b></td>
<td width="87"><b><font size="2">Customer</font></b></td>

<td width="64"><b><font size="2">State</font></b></td>
</tr>
</thead>
<tbody>
<!--webbot bot="DatabaseRegionStart"
s-columnnames="TroubleNum,Customer,ServiceInstance,State,Status,TroubleType,Description,ReceivedTime,ModifiedDate,Resolution"
s-columntypes="202,202,202,202,202,202,202,135,135,202"
s-dataconnection="Database1" b-tableformat="TRUE" b-menuformat="FALSE"
s-menuchoice="TroubleNum" s-menuvalue="TroubleNum" b-tableborder="TRUE"
b-tableexpand="TRUE" b-tableheader="TRUE" b-listlabels="TRUE"
b-listseparator="TRUE" i-listformat="0" b-makeform="TRUE" s-recordsource
s-displaycolumns="TroubleNum,Customer,State,Status," s-criteria s-order
s-sql="SELECT * FROM ISP WHERE (Customer LIKE '::Customer::%' AND State LIKE
'Cleared%' AND TroubleDispositionCode LIKE 'G12%' ) ORDER BY ReceivedTime
ASC,TroubleNum ASC" b-procedure="FALSE" clientside suggestedext="asp"
s-defaultfields="Customer=" s-norecordsfound="No records returned."
i-maxrecords="256" i-groupsize="0" botid="0" u-dblib="_fpclass/fpdblib.inc"
u-dbrgn1="_fpclass/fpdbrgn1.inc" u-dbrgn2="_fpclass/fpdbrgn2.inc" tag="TBODY"
preview="<tr><td colspan=64 bgcolor="#FFFF00" align="left" width="100%"><font
color="#000000">This is the start of a Database Results region. The page must
be fetched from a web server with a web browser to display correctly; the
current web is stored on your local disk or network.</font></td></tr>"
b-WasTableFormat="TRUE" startspan --><!--#include
file="_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database
Results component on this page is unable to display database content. The
page must have a filename ending in '.asp', and the web must be hosted on a
server that supports Active Server Pages.</div>");
</SCRIPT>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top