| | |
|
|
|
display message when search is empty |
| message from -D- on 18 Jul 2004 |
I want to add a simple message to display if no records are found in a
search query. How could I append the following code to display a message
"No records found”?
<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "1"
If (Request.Form("txtKeywords") <> "") Then
Recordset1__MMColParam = Request.Form("txtKeywords")
End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows
Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_DBConn_STRING
strTest = Request.Form("selMatchType")
Select Case strTest
Case "Exact"
Recordset1.Source = "SELECT * FROM tblProducts WHERE prod_number = '" +
Replace(Recordset1__MMColParam, "'", "''") + "'"
Case "Ending"
Recordset1.Source = "SELECT * FROM tblProducts WHERE prod_number LIKE '%"
+ Replace(Recordset1__MMColParam, "'", "''") + "'"
Case "Contain"
Recordset1.Source = "SELECT * FROM tblProducts WHERE prod_number LIKE '%"
+ Replace(Recordset1__MMColParam, "'", "''") + "%'"
Case "Begin"
Recordset1.Source = "SELECT * FROM tblProducts WHERE prod_number LIKE '" +
Replace(Recordset1__MMColParam, "'", "''") + "%'"
End Select
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()
Recordset1_numRows = 0
%>
I was trying to include another case where the Recordset1.Source came up
empty or something like that.
Case Else
Recordset1.Source = “”
Response.Write("No records found.")
But that doesn’t work. Any help is appreciated. Thanks.
-D-
|
| Craig replied to -D- on 19 Jul 2004 |
D,
presumably things like Case "" doesn't work, or perhaps NULL, or simply
else?
Anyways, by far the simplest way (simple is best) would be to simply write
your message onto the page and enclose it in a 'Show Region if RS Empty'
server behaviour.
Craig
"-D-" <noone@nospam.com> wrote in message
news:cdev50$gnd$1@forums.macromedia.com...
|
| -D- replied to Craig on 18 Jul 2004 |
Craig,
Is there an extension for the "Show Region if RS Empty" server behavior? If
so, where can I download it? Thanks for your help.
-D-
"Craig" <csintheuk@hotmail.com> wrote in message
news:cdfhbf$5fp$1@forums.macromedia.com...
|
| Craig replied to -D- on 19 Jul 2004 |
D,
I think its just a standard part of the DW installation, should be on your
Server Behaviours panel, under Show Region
if not, download it from the MM site
Craig
"-D-" <noone@nospam.com> wrote in message
news:cdfifs$6do$1@forums.macromedia.com...
|
|
Archived message: display message when search is empty (Macromedia Dreamweaver Web Design)