|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
If *this* is not equal to *this*
The syntax would be If varOption_A <> varOption_B then
do this... else do this end if Right? How does this work when trying to query a DB? Same way? I am trying to pull info from a DB based upon if the criteria matches one another (in my case based upon dates). If today or tomorrow matches a day in the DB, it works. If it does not, or I happen to run out of dates altogethr, it gives me : Error Type: (0x80020009) Exception occurred. /Calendar/events.asp, line 26 According to line 26, this is what I have: If rs("vardate")=varCalendar then My code is as follows for those that could shed some light on what I am doing wrong. Thanks. G3 ==Code== Dim varCalendar varCalendar=request.querystring("evtdate") Dim DBConn,rs,strConn Set DBConn = Server.CreateObject("ADODB.Connection") Set rs= Server.CreateObject("ADODB.Recordset") strConn="DSN=events" DBConn.Open strConn rs.open "Select * from tblevents where vardate=#" & request.querystring("evtdate") & "#", strConn,2, 3 If rs("vardate")=varCalendar then response.write "Here's whats happening for "&varCalendar &"<br>" While NOT rs.EOF response.write rs("vardate") & " " & rs("event") & "<br>" rs.movenext wend rs.close dbconn.close set rs = Nothing set dbconn = nothing else response.write "Nothing to see here..." rs.close dbconn.close set rs = Nothing set dbconn = nothing end if |
|
#2
|
|||
|
|||
|
I can't say I know a lot about ASP, but about databases...
You don't need to check to see if rs("vardate")=varCalendar The SQL statement eleminates the need for that, what you want to do is see if any records came back Try this: If NOT rs.EOF then response.write "Here's whats happening for "&varCalendar &"<br>" While NOT rs.EOF response.write rs("vardate") & " " & rs("event") & "<br>" rs.movenext wend rs.close dbconn.close set rs = Nothing set dbconn = nothing else response.write "Nothing to see here..." rs.close dbconn.close set rs = Nothing set dbconn = nothing end if I don't know is NOT is proper syntax in ASP, but you get the idea, S- |
|
#3
|
|||
|
|||
|
I shall give it a whack a bit later and fill you in as to whether it worked or not.
Thanks. ![]() |
|
#4
|
|||
|
|||
|
LOL.
Sbaxter...it worked. Thank you. I have been racking my brains out on this for the past .... few hours, and this simple line of code for the past 3 days. I am a newb and don't like asking for help until I am at this point. ![]() Again, thank you SO very much. Ginzu3 |
|
#5
|
|||
|
|||
|
Glad to help!
S- |
![]() |
| Viewing: ASP Free Forums > Database > Microsoft Access Help > If *this* is not equal to *this* |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|