473,406 Members | 2,378 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Trying to display a message if there is nothing available

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!
Jul 19 '05 #1
4 3038
Are you sure that's where the error is occurring? If so:

Replace "elseif" with just a plain "else"

Ray at work

"J. Muenchbourg" <an*******@dex.com> wrote in message
news:ua**************@TK2MSFTNGP12.phx.gbl...
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!

Jul 19 '05 #2
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.
Jul 19 '05 #3
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" <an*******@dex.com> wrote in message
news:ua**************@TK2MSFTNGP12.phx.gbl...
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!

Jul 19 '05 #4
<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
Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: apchar | last post by:
I am trying to use php as a kind of servlet to act as a middle man between a java applet and mysql. I know java has jdbc but it's flakey and painful. php access to mysql is much nicer. So I have:...
11
by: HolaGoogle | last post by:
hi all, can you please tell me what i should do to avoid session timeout when displaying my database info in my asp form (DisplayUserDatabase.asp)??? ** actualy it does load and display the...
13
by: Dan R Brown | last post by:
I have a large form that is generated dynamically in a jsp using xml / xslt. So, to break up this form into several "tabbed" sections, I break up the form using <div> tags. Each <div...
33
by: selowitch | last post by:
I've been searching in vain for a way to present typographically correct fractions (not resorting to <sup> and <sub> tags) but have been frustrated by the fact that the glyphs for one-half,...
7
by: Stefan Finzel | last post by:
Hi, is there a way to change the display property on Windows Mobile 2003 SE Mobile/Pocket Internet Explorer? See following example. Please note: visibilty property has the same problem. Is...
25
by: Neo Geshel | last post by:
This works: <form> <asp:TextBox id="name" /> <%= name.ClientID %> </form> But this DOES NOT work: <form>
3
by: kymjay | last post by:
I am trying to read a file in with the following code and I am getting a system.nullreferenceexception error. The error is “object reference not set to an instance of an object”. This is my...
1
by: KitKat | last post by:
With the help of kind, brilliant folks, I have been working on this program that uses a combo box selection to display six different jpgs. The jps are a time stamp, and the files are located in six...
4
by: Martin Schneider | last post by:
Hi! I am currently writing an application allowing to plan events on a time basis. The ideal approach would be to show a "timeline" display, just like in a video editing software, allowing to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.