HighDots Forums  

display message when search is empty

Macromedia Dreamweaver Macromedia Dreamweaver Discussions (macromedia.dreamweaver)


Discuss display message when search is empty in the Macromedia Dreamweaver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
-D-
 
Posts: n/a

Default display message when search is empty - 07-18-2004 , 06:40 PM






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-



Reply With Quote
  #2  
Old   
Craig
 
Posts: n/a

Default Re: display message when search is empty - 07-19-2004 , 12:06 AM






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 (AT) nospam (DOT) com> wrote

Quote:
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-





Reply With Quote
  #3  
Old   
-D-
 
Posts: n/a

Default Re: display message when search is empty - 07-19-2004 , 12:10 AM



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 (AT) hotmail (DOT) com> wrote

Quote:
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 (AT) nospam (DOT) com> wrote in message
news:cdev50$gnd$1 (AT) forums (DOT) macromedia.com...
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-







Reply With Quote
  #4  
Old   
Craig
 
Posts: n/a

Default Re: display message when search is empty - 07-19-2004 , 12:38 AM



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 (AT) nospam (DOT) com> wrote

Quote:
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 (AT) hotmail (DOT) com> wrote in message
news:cdfhbf$5fp$1 (AT) forums (DOT) macromedia.com...
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 (AT) nospam (DOT) com> wrote in message
news:cdev50$gnd$1 (AT) forums (DOT) macromedia.com...
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-









Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.