Thursday, March 22, 2012

newby needs no record found help

ok I'm new to ASP but I have everything working great I have a form in which client can look up status i want to be able to redirect to a no record found page when a wrong id number is entered here is website http://www.cargogroupllc.com/cargotracking.asp example of good record enter 12321 example of bad record 33333333 please help this is last thing I need to accomplishShow the code of the page, then I can help you!
Edited by SomeNewKid. Please post code between<code> and</code> tags.



ASP protion of page

<%
strSearch = Request.Form("search")

If strSearch <> "" Then
Dim strConnect, SQL
Dim RS
strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("securefiles/ITtracking.mdb") & ";"

SQL = "SELECT * FROM ITTable WHERE INSTR(ITTable.ITNumber,'" & strSearch & "')"

Set RS = Server.CreateObject("Adodb.Recordset") 'Used for pulling main categories from DB
RS.Open SQL,strConnect

'If Len(strSearch) > 1 AND LCase(strSearch) = LCase(RS("Name")) Then
Response.Write RS("ITNumber") & "<BR><BR>"
Response.Write RS("DateArrived") & "<BR><BR>"
Response.Write RS("RefNumber") & "<BR><BR>"
Response.Write RS("Quantity") & "<BR><BR>"
Response.Write RS("PUDate") & "<BR><BR>"
Response.Write RS("PUNumber") & "<BR><BR>"
Response.Write RS("OriginalIT") & "<BR><BR>"
Response.Write RS("ValidatedIT") & "<BR><BR>"
Response.Write RS("CustomsRelease") & "<BR><BR>"
Response.Write RS("ShippingTally") & "<BR><BR>"
Response.Write RS("NVOCCRelease") & "<BR><BR>"
Response.Write RS("PaperlessIT") & "<BR><BR>"
'End If

'If Len(strSearch) <= 0 Then
'Response.Write "Sorry no record & "<BR>"
'Response.Write RS(sorry no record) & "<BR><BR>"

'End If

RS.MoveNext

RS.Close

End If

%>

0 comments:

Post a Comment