I have a form with 6 boxes that serach a database to match numbers.
I have run into a problem with my SQL string
if I type lets say 6 in the firt box 8 in the second 23 in the third 25 in the forth 34 in the fifth
It will display all the 6's from the first column named lot1 all the 8's from the second column 23 from the third column 25 from the 4'th column and 34 from the 5th column
As you can see my problem is if the number in column one is 8 then a search for 8 in column two will not show it.
How can I get round this?
The only column that needs to be specific is column 6 named power
Any help would be great.
Thanks
<%
Function Highlight(rsField,formValue)
IF ucase(rsField) = ucase(formValue) then
Highlight="<font color=magenta size=5><strong>" & rsField & "</font></strong>"
ELSE
Highlight=rsField
END IF
End Function
%>
<%
dim inttext1,inttext2,inttext3,intext4,inttext5,intpower
inttext1 = cInt(Request.Form("text1"
)
inttext2 = cInt(Request.Form("text2"
)
inttext3 = cInt(Request.Form("text3"
)
inttext4 = cInt(Request.Form("text4"
)
inttext5 = cInt(Request.Form("text5"
)
intpower = cInt(Request.Form("power"
)
set cnn = Server.CreateObject("ADODB.Connection"
cnn.Open "driver={Microsoft Access Driver (*.mdb)};;DBQ=D:/ragolraiders/writedatabase/lottery.mdb;"
strSQL = "SELECT * FROM lottery WHERE lot1=" & inttext1 & " OR lot2=" & inttext2 & " OR lot3=" & inttext3 & " OR lot4=" & inttext4 & " OR lot5=" & inttext5 & " OR power=" & intpower & ";"
Set rs = cnn.execute(strSQL)
%><title>Winning Numbers</title>
<body bgcolor="#999999">
<div align="center">
<p><strong><font color="#0000A0" size="5"><img src="webmail_logo.gif" width="198" height="88"></font></strong></p>
<p><strong><font color="#0000A0" size="5">Winning Numbers will be highlighted
in Magenta</font></strong></p>
<table width="884" border="2" bordercolor="#000000" bordercolorlight="#CCCCCC" bordercolordark="#000000" bgcolor="#FFFFFF">
<%
While rs.EOF = false
%>
<tr bgcolor="#CCCCCC">
<td height="23">
<div align="center"><font color="#000000" size="4"><%=Highlight(rs.fields("lot1"
,inttext1)%>
</font></div></td>
<td>
<div align="center"><font color="#000000" size="4"><%=Highlight(rs.fields("lot2"
,inttext2)%></font></div></td>
<td>
<div align="center"><font color="#000000" size="4"><%=Highlight(rs.fields("lot3"
,inttext3)%></font></div></td>
<td>
<div align="center"><font color="#000000" size="4"><%=Highlight(rs.fields("lot4"
,inttext4)%></font></div></td>
<td>
<div align="center"><font color="#000000" size="4"><%=Highlight(rs.fields("lot5"
,inttext5)%></font></div></td>
<td>
<div align="center"><font color="#FF0000" size="4"><%=Highlight(rs.fields("power"
,intpower)%></font></div></td>
</tr>
<%
rs.MoveNext
WEND
%>
</table>
<p><a href="search.asp">Go back and search again</a></p>
<p><input type=button value="Print this page" onClick="window.print()">
</p>
</div>
<%
rs.Close()
set rs = nothing
cnn.Close()
set cnn = nothing
%>
I have run into a problem with my SQL string
if I type lets say 6 in the firt box 8 in the second 23 in the third 25 in the forth 34 in the fifth
It will display all the 6's from the first column named lot1 all the 8's from the second column 23 from the third column 25 from the 4'th column and 34 from the 5th column
As you can see my problem is if the number in column one is 8 then a search for 8 in column two will not show it.
How can I get round this?
The only column that needs to be specific is column 6 named power
Any help would be great.
Thanks
<%
Function Highlight(rsField,formValue)
IF ucase(rsField) = ucase(formValue) then
Highlight="<font color=magenta size=5><strong>" & rsField & "</font></strong>"
ELSE
Highlight=rsField
END IF
End Function
%>
<%
dim inttext1,inttext2,inttext3,intext4,inttext5,intpower
inttext1 = cInt(Request.Form("text1"
inttext2 = cInt(Request.Form("text2"
inttext3 = cInt(Request.Form("text3"
inttext4 = cInt(Request.Form("text4"
inttext5 = cInt(Request.Form("text5"
intpower = cInt(Request.Form("power"
set cnn = Server.CreateObject("ADODB.Connection"
cnn.Open "driver={Microsoft Access Driver (*.mdb)};;DBQ=D:/ragolraiders/writedatabase/lottery.mdb;"
strSQL = "SELECT * FROM lottery WHERE lot1=" & inttext1 & " OR lot2=" & inttext2 & " OR lot3=" & inttext3 & " OR lot4=" & inttext4 & " OR lot5=" & inttext5 & " OR power=" & intpower & ";"
Set rs = cnn.execute(strSQL)
%><title>Winning Numbers</title>
<body bgcolor="#999999">
<div align="center">
<p><strong><font color="#0000A0" size="5"><img src="webmail_logo.gif" width="198" height="88"></font></strong></p>
<p><strong><font color="#0000A0" size="5">Winning Numbers will be highlighted
in Magenta</font></strong></p>
<table width="884" border="2" bordercolor="#000000" bordercolorlight="#CCCCCC" bordercolordark="#000000" bgcolor="#FFFFFF">
<%
While rs.EOF = false
%>
<tr bgcolor="#CCCCCC">
<td height="23">
<div align="center"><font color="#000000" size="4"><%=Highlight(rs.fields("lot1"
</font></div></td>
<td>
<div align="center"><font color="#000000" size="4"><%=Highlight(rs.fields("lot2"
<td>
<div align="center"><font color="#000000" size="4"><%=Highlight(rs.fields("lot3"
<td>
<div align="center"><font color="#000000" size="4"><%=Highlight(rs.fields("lot4"
<td>
<div align="center"><font color="#000000" size="4"><%=Highlight(rs.fields("lot5"
<td>
<div align="center"><font color="#FF0000" size="4"><%=Highlight(rs.fields("power"
</tr>
<%
rs.MoveNext
WEND
%>
</table>
<p><a href="search.asp">Go back and search again</a></p>
<p><input type=button value="Print this page" onClick="window.print()">
</p>
</div>
<%
rs.Close()
set rs = nothing
cnn.Close()
set cnn = nothing
%>