473,401 Members | 2,127 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,401 software developers and data experts.

Asp If statement with condition

229 100+
Hi, I have this IF statement

Expand|Select|Wrap|Line Numbers
  1.                     <%
  2. If rsCard("DefaultMessage")="e-card" Then
  3. %>
  4.  
  5.  
  6. <a href="cards.asp?Post=<%=rsCard("Post")%>">
  7. <%
  8. Else
  9. %>
  10. <a href="gallery.asp?author=<%=rsCard("author")%>">
  11. <%
  12. End If
  13. %>
  14.  
  15. <I><%=rsCard("DefaultMessage")%></I><a> 
The default message will include other text apart from the word e-card. What I need is for the IF statement to say. IF the default message includes the word e-card in it somewhere, then xxxxxx else xxxxxxxx
and not if it is equal to e-card.
Anyone know if this is possible?

Thanks for any help in advance.
Richard
Oct 16 '07 #1
2 5394
markrawlingson
346 Expert 100+
Sure it is... Use the InStr method.

Expand|Select|Wrap|Line Numbers
  1. <%
  2. 'If the word "e-card" appears in rsCart("DefaultMessage") at least once..
  3. If InStr(rsCard("DefaultMessage"),"e-card") > 0 Then
  4. %>
  5. <a href="cards.asp?Post=<%=rsCard("Post")%>">
  6. <%
  7. 'if it does not include the word "e-card" at least once...
  8. Else
  9. %>
  10. <a href="gallery.asp?author=<%=rsCard("author")%>">
  11. <%
  12. End If
  13. %>
  14. <I><%=rsCard("DefaultMessage")%></I><a>
  15.  
Hope this helps.
Sincerely,
Mark
Oct 16 '07 #2
fran7
229 100+
Dear Mark,
Thanks worked a treat.
I have had such geat help from this forum.
Thanks
Richard
Oct 16 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

28
by: Fábio Mendes | last post by:
I'm sorry if it's an replicate. Either my e-mail program is messing with things or the python-list sent my msg to /dev/null. I couldn't find anything related in previous PEP's, so here it goes a...
6
by: crispy | last post by:
I am trying to say if (condition) is true OR (condition) is true THEN Can I use OR or do ihave to break it down into an elseif statement? I tried OR but it does not seem to work. thanks....
8
by: Henk van Winkoop | last post by:
Hello, I debugged some html file and found this: ------------------------------------------------------------ <script language="JavaScript"> if ( some_statement ) { function MyFunction (...
2
by: Rhino | last post by:
Is there some kind of requirement that a DECLARE CONTINUE HANDLER statement follow the DECLARE CURSOR statement in an SQL stored procedure? I am running DB2 V8.2.1 on Windows XP and am writing my...
2
by: mr_mach7 | last post by:
I have a situation in which I want to dynamically build a SQL statement based upon criteria. The statement would contain different fields depending upon the criteria. I created a Stored Procedure...
3
by: Ben R. | last post by:
In an article I was reading (http://www.ftponline.com/vsm/2005_06/magazine/columns/desktopdeveloper/), I read the following: "The ending condition of a VB.NET for loop is evaluated only once,...
5
by: jimc52 | last post by:
Hello Everyone: I am hoping one of the gurus here will give me some help. I have designed a form with some check boxes. I put the checkboxes there on the form so later I could use them as flags on...
7
by: reon | last post by:
In the below code.. else statements didnt work correctly... the program is to add the positive and negative numbers... if we enter alphabets it will show the wrong entry ,, but thats not...
22
by: John | last post by:
Hi Folks, I'm experimenting a little with creating a custom CEdit control so that I can decide on what the user is allowed to type into the control. I started off only allowing floating point...
3
by: sjohnson1984 | last post by:
Hello all, thanks for taking the time out to read this. I have a javascript function, the purpose of which is to compare 2 form values and redirect the user if two values are met - however,...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.