Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Trying to display a message if there is nothing available

Reply
Thread Tools

Trying to display a message if there is nothing available

 
 
J. Muenchbourg
Guest
Posts: n/a
 
      11-25-2003
I've created a page where users can view a free sports pick for the day;
but if there is no free pick yet for that day, I want to display a
"Check Back later today " message with the following:

<%
dim sqlstr
sqlstr = "SELECT fpick FROM tblArticles where handid = '40' and
ArticleDate = '" & date() & "'"

Set rsor = Server.CreateObject("ADODB.Recordset")
rsor.Open sqlstr,sqlc,3
%>
<h4><% if rsor("fpick") <> "" then
response.write rsor("fpick")
elseif rsor("fpick") = "" then
response.write "Check back later today<br>"
end if %>

This produces an "Exception Occured" error if there is no free pick

???
Muench

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
 
 
 
Ray at
Guest
Posts: n/a
 
      11-25-2003
Are you sure that's where the error is occurring? If so:

Replace "elseif" with just a plain "else"

Ray at work

"J. Muenchbourg" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I've created a page where users can view a free sports pick for the day;
> but if there is no free pick yet for that day, I want to display a
> "Check Back later today " message with the following:
>
> <%
> dim sqlstr
> sqlstr = "SELECT fpick FROM tblArticles where handid = '40' and
> ArticleDate = '" & date() & "'"
>
> Set rsor = Server.CreateObject("ADODB.Recordset")
> rsor.Open sqlstr,sqlc,3
> %>
> <h4><% if rsor("fpick") <> "" then
> response.write rsor("fpick")
> elseif rsor("fpick") = "" then
> response.write "Check back later today<br>"
> end if %>
>
> This produces an "Exception Occured" error if there is no free pick
>
> ???
> Muench
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



 
Reply With Quote
 
 
 
 
Bob Barrows
Guest
Posts: n/a
 
      11-25-2003
J. Muenchbourg wrote:
> I've created a page where users can view a free sports pick for the
> day; but if there is no free pick yet for that day, I want to display
> a "Check Back later today " message with the following:
>
> <%
> dim sqlstr
> sqlstr = "SELECT fpick FROM tblArticles where handid = '40' and
> ArticleDate = '" & date() & "'"
>
> Set rsor = Server.CreateObject("ADODB.Recordset")
> rsor.Open sqlstr,sqlc,3
> %>
> <h4> <% if rsor("fpick") <> "" then
> response.write rsor("fpick")
> elseif rsor("fpick") = "" then
> response.write "Check back later today<br>"
> end if %>
>
> This produces an "Exception Occured" error if there is no free pick
>

Use EOF to determine if the recordset is empty:

<% if NOT rsor.EOF then
response.write rsor("fpick")
else
response.write "Check back later today<br>"
end if %>

HTH,
Bob Barrows

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


 
Reply With Quote
 
TomB
Guest
Posts: n/a
 
      11-25-2003
Set rsor = sqlc.Execute(sqlstr)
Response.write "<h4>"
if rsor.EOF then
Response.write "Check back later today"
else
Response.write rsor.Fields("fpick")
end if
Response.write "</h4>"


"J. Muenchbourg" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I've created a page where users can view a free sports pick for the day;
> but if there is no free pick yet for that day, I want to display a
> "Check Back later today " message with the following:
>
> <%
> dim sqlstr
> sqlstr = "SELECT fpick FROM tblArticles where handid = '40' and
> ArticleDate = '" & date() & "'"
>
> Set rsor = Server.CreateObject("ADODB.Recordset")
> rsor.Open sqlstr,sqlc,3
> %>
> <h4><% if rsor("fpick") <> "" then
> response.write rsor("fpick")
> elseif rsor("fpick") = "" then
> response.write "Check back later today<br>"
> end if %>
>
> This produces an "Exception Occured" error if there is no free pick
>
> ???
> Muench
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



 
Reply With Quote
 
dlbjr
Guest
Posts: n/a
 
      11-25-2003
<SCRIPT language="vbscript" runat="server">
Function GetPickOfTheDay()
GetPickOfTheDay = "Check back later today"
Set Conn = CreateObject("ADODB.Connection")
Conn.ConnectionString = "What ever"
sqlstr = "SELECT fpick FROM tblArticles WHERE handid='40' AND
ArticleDate='"& Date() & "'"
Set rs = CreateObject("ADODB.Recordset")
rs.Open sqlstr,sqlc,3
If Not rs.EOF Then
GetPickOfTheDay = rs("fpick")
End IF
rs.Close
Set rs = Nothing
Set Conn = Nothing
End Function
</SCRIPT>
<h4><%=GetPickOfTheDay()%><br/></h4>


-dlbjr

Discerning resolutions for the alms


 
Reply With Quote
 
 
 
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
re module: Nothing to repeat, but no sre_constants.error: nothing torepeat ? Devin Jeanpierre Python 2 02-14-2012 01:33 PM
rendering PDF and trying to display a message David Cho ASP .Net 2 03-11-2005 06:10 PM
trying to "use Sys::Syslog" but I get nothing ... Karen Wieprecht Perl Misc 11 01-26-2005 03:06 PM
I am getting loads of spam by e-mail.Most of it is not even addressed to me so god knows how I am receiving it. Any ideas . Is there a spam guard available on blueyonder? How do I get it on my system if there is?Cheers GW Geoff/Elaine Computer Support 11 11-16-2004 11:17 PM
Trying to display "Page has Expired" message Ed Burns ASP General 3 08-05-2004 09:41 PM



Advertisments