DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: How to deal with no results from query

Hybrid View

  1. #1
    Shawn Call Guest

    How to deal with no results from query



    I am new to asp and how an Access Database I'm working
    with. My question is, how to I set up the code to
    display a message like "NO QUERY RESULTS" whenever
    this happens? Here's my code:

    BTW, please reply to my email address, as I don't
    have the chance to often check here.
    -Thanks

    <%
    Param = Request.QueryString("Param")
    Data = Request.QueryString("Data")
    %>
    <%
    Session.timeout = 1
    If IsObject(Session("sbdccalendar_conn")) Then
    Set conn = Session("sbdccalendar_conn")
    Else
    Set conn = Server.CreateObject("ADODB.Connection")
    conn.open "sbdccalendar","",""
    Set Session("sbdccalendar_conn") = conn
    End If
    %>
    <%
    sql = "SELECT DISTINCTROW Format([StartDate],'dddd
    mmmm d\, yyyy') AS WEBdate, ' -
    '+[Employees]![FirstName]+' '+[Employees]![LastName]+'
    '+[SBDC Seminars]![Event Description] AS
    WEBdesc, Left(CStr([Events]![StartTime]),4)+' '+Right(CStr([Events]![StartTime]),2)+'
    -
    '+Left(CStr([Events]![EndTime]),4)+' '+Right(CStr([Events]![EndTime]),2)+',
    '+[Events]![Location] AS
    Webplace, Events.EventName, Events.EmployeeID, Events.StartDate
    FROM [SBDC Seminars] INNER JOIN
    (Employees RIGHT JOIN Events ON Employees.EmployeeID
    = Events.EmployeeID) ON [SBDC
    Seminars].[Event Name] = Events.EventName WHERE (((Events.StartDate)
    Between (Now()-1) And
    (Now()+100))) "
    If cstr(Param) <> "" And cstr(Data) <> "" Then
    sql = sql & " And [" & cstr(Param) & "] =
    " & cstr(Data)
    End If
    sql = sql & " ORDER BY Events.StartDate "
    Set rs = Server.CreateObject("ADODB.Recordset")
    rs.Open sql, conn, 3, 3
    %>

  2. #2
    Andrew King Guest

    Re: How to deal with no results from query

    Shawn - see my response in the web.asp group

    Andrew



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center