function Help Please??

Results 1 to 2 of 2

Thread: function Help Please??

  1. #1
    Join Date
    Dec 1969

    Default function Help Please??

    hi and Help please??????<BR><BR>Wrote a function to get the number of days that a testsite was booked for. At the moment, everything else is working as it brings up all the testsites and the week numbers but there should be numbers(1-7days) in the grids below to show how many days the testsite is booked for. Used to work but changed the database a bit. <BR>I know what the problem is but need help writing the code. I changed the testsites to have a room id (room_id starts at around 1009) and all testsites have a unique room id! But at the moment the iRoom in the function is looking for room ids starting at 0,1,2...etc and it is not showing anything.<BR>Here is the function:<BR><BR>Function getNoDays(iStartDate, iEndDate, iRoom)<BR><BR> sql = "SELECT COUNT(*) AS Days FROM tblBookings WHERE " & _<BR> "(room_id = " & iRoom & ") AND (booking_date &#062; CONVERT(DATETIME, &#039;" & iStartDate & " 00:00:00&#039;, 102)) " & _<BR> "AND (booking_date &#060; CONVERT(DATETIME, &#039;" & iEndDate & " 00:00:00&#039;, 102))"<BR>&#039;*****iRoom is the problem - need to assign it the actual room id&#039;s instead ot the counter that it is currently doing!****<BR> <BR> &#039;Response.Write "SQL Room: " & sql & vbCrLf <BR> &#039;Response.Write "Room: " & iRoom & vbCrLf<BR><BR> Set rsDays= objConnection.Execute(sql) <BR> getNoDays = rsDays("Days")<BR> rsDays.close <BR>End Function<BR><BR>Thanks

  2. #2
    Join Date
    Dec 1969

    Default RE: function Help Please??

    Hi,<BR><BR>Even if your count is wrong it should still return a number even if its 0, so your statement "and it is not showing anything." kinda suggests theres a problem with the way you are displaying the data - can you post that line, there maybe a problem with the count but we need to get the value showing first...<BR><BR>Oli.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts