Help Please !!

Discussion in 'ASP General' started by Tom, Aug 17, 2004.

  1. Tom

    Tom Guest

    I'm playing around with an events calendar I found @
    http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=6976&lngWId=4

    This works great apart for it only shows one event per day..

    I have added more events to a day in the DB, but am struggling to get it to
    display them...

    everything I hvae tried has resulted in the calendar being corrupted.

    if it displays the evens, I lose the dates and formatting..

    I can post the code, but didn't want to create a large post !

    can anyone offer a bit of advice ?

    Thanks
    Tom, Aug 17, 2004
    #1
    1. Advertising

  2. Tom

    Evertjan. Guest

    Tom wrote on 17 aug 2004 in microsoft.public.inetserver.asp.general:
    > I'm playing around with an events calendar I found @
    > http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=697
    > 6&lngWId=4
    >
    > This works great apart for it only shows one event per day..
    > I have added more events to a day in the DB, but am struggling to get
    > it to display them...
    > everything I hvae tried has resulted in the calendar being corrupted.
    > if it displays the evens, I lose the dates and formatting..
    > I can post the code, but didn't want to create a large post !
    > can anyone offer a bit of advice ?


    It seems to me, Tom, that there are two ways for you to go:

    1
    analyze the essentials of this code and then build your own application
    from scratch. This wil give you a learning curve, which steepness you van
    controll. There will be help in many tutorials, in the archives of this NG,
    and by asking here.

    2
    look for an ready application on the web that fits your requirement more or
    less, without understanding the code workings, and come to live with the
    deficiencies.

    Asking the NG to rewrite a ready application for you does not seem an
    option to me.

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
    Evertjan., Aug 17, 2004
    #2
    1. Advertising

  3. Tom

    Tom Guest

    "Evertjan." <> wrote in message
    news:Xns954861A14E52Eeejj99@194.109.133.29...

    >
    > It seems to me, Tom, that there are two ways for you to go:
    >

    Hi,

    I wasn't asking for someone to write all the code for me...
    I can see where I think the problem is, I was after some advise on how to
    resolve it.


    I have posted the relevant bit below.

    If I edit this section:
    ' Checks for a message on the day being written
    strSQL = "SELECT * FROM calendar WHERE calendarDate = #" & dtOnDay & "#"
    Set objRS = objConn.Execute(strSQL)
    If NOT objRS.EOF Then
    dailyMsg = objRS("calendarText")
    Else
    dailyMsg = ""
    End If
    Set objRS = Nothing

    I screws the whole thing up... Could some please explain and point me in the
    right direction, how I can get this to loop through the database, inserting
    multiple records into a day..

    <%
    Set objConn = Server.CreateObject("ADODB.Connection")
    strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" &
    Server.MapPath("db.mdb") & ";Persist Security Info=False;"
    objConn.Open(strConn)

    For iWeek = 1 To iRows
    Response.Write "<TR VALIGN=TOP>"
    For iDay = 1 To iColumns
    ' Checks to see if there is a day this month on the date being written
    If aCalendarDays((iWeek-1)*7 + iDay) > 0 then
    dtOnDay = DateSerial(Year(dtCurrentDate), Month(dtCurrentDate),
    aCalendarDays((iWeek-1)*7 + iDay))

    ' Checks to see if the day being printed is today
    If dtOnDay = dtToday Then
    Response.Write "<TD HEIGHT=55 CLASS='calCurrentDay'>"
    Else
    Response.Write "<TD HEIGHT=55 CLASS='calOtherDay'>"
    End If

    ' Checks to see the type of calendar (editable or non-editable)
    If (bolEditable) then
    strPage = "updateCalendar_form.asp?currentDate=" & dtOnDay
    Else
    strPage = "viewDay.asp?currentDate=" & dtOnDay
    End If

    ' Checks for a message on the day being written
    strSQL = "SELECT * FROM calendar WHERE calendarDate = #" & dtOnDay & "#"
    Set objRS = objConn.Execute(strSQL)
    If NOT objRS.EOF Then
    dailyMsg = objRS("calendarText")
    Else
    dailyMsg = ""
    End If
    Set objRS = Nothing

    ' Checks to see if the message is too long to be displayed in the mini
    date box
    If (Trim(dailyMsg) = Trim(Left(dailyMsg, intCharToShow))) Then
    Else
    dailyMsg = Trim(Left(dailyMsg, intCharToShow-4)) & " ..."
    End If

    Response.Write ("<A HREF=""" & strPage & """>&nbsp;" &
    aCalendarDays((iWeek-1)*7 + iDay) & "<BR>&nbsp;&nbsp;" & FormatStr(dailyMsg)
    & "</A>")
    Else
    Response.Write ("<TD HEIGHT=50 CLASS='calNotDay'>&nbsp;")
    End IF

    Response.Write "</TD>"
    Next
    Response.Write "</TR>"
    Next

    objConn.Close
    set objConn = Nothing
    %>
    Tom, Aug 17, 2004
    #3
  4. Tom

    Tom Guest

    "Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
    news:...
    > Here ya go
    > http://www.darkfalz.com/1050
    >
    >
    > --

    Thanks, I will take a look, but I would prefer to understand how to get the
    other one working..
    Tom, Aug 17, 2004
    #4
  5. Tom

    Evertjan. Guest

    Tom wrote on 17 aug 2004 in microsoft.public.inetserver.asp.general:
    > .......
    > If NOT objRS.EOF Then
    > dailyMsg = objRS("calendarText")
    > Else
    > dailyMsg = ""
    > End If
    > Set objRS = Nothing
    >


    dtOnDay = "2004-08-17"
    strSQL = _
    "SELECT * FROM calendar " &
    "WHERE calendarDate = #" & dtOnDay & "#"
    Set objRS = objConn.Execute(strSQL)
    n=0
    do until objRS.EOF
    n=n+1
    dayMsg(n) = objRS("calendarText")
    objRS.MoveNext
    loop


    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
    Evertjan., Aug 17, 2004
    #5
  6. Tom

    Tom Guest

    On 17 Aug 2004 16:51:59 GMT, Evertjan. wrote:


    > dtOnDay = "2004-08-17"
    > strSQL = _
    > "SELECT * FROM calendar " &
    > "WHERE calendarDate = #" & dtOnDay & "#"
    > Set objRS = objConn.Execute(strSQL)
    > n=0
    > do until objRS.EOF
    > n=n+1
    > dayMsg(n) = objRS("calendarText")
    > objRS.MoveNext
    > loop


    This seems to error !

    the line dayMsg(n) seems to be the problem.

    if I remove (n) I get the calendar displayed correctly, but the dates are
    all filled in with the last entry...
    Tom, Aug 17, 2004
    #6
  7. Tom

    Evertjan. Guest

    Tom wrote on 17 aug 2004 in microsoft.public.inetserver.asp.general:
    > On 17 Aug 2004 16:51:59 GMT, Evertjan. wrote:
    >
    >
    >> dtOnDay = "2004-08-17"
    >> strSQL = _
    >> "SELECT * FROM calendar " &
    >> "WHERE calendarDate = #" & dtOnDay & "#"
    >> Set objRS = objConn.Execute(strSQL)
    >> n=0
    >> do until objRS.EOF
    >> n=n+1
    >> dayMsg(n) = objRS("calendarText")
    >> objRS.MoveNext
    >> loop

    >
    > This seems to error !
    >
    > the line dayMsg(n) seems to be the problem.
    >
    > if I remove (n) I get the calendar displayed correctly,
    > but the dates are
    > all filled in with the last entry...
    >


    You will need to dim the array beforehand,

    dim dayMsg(20)

    I thought you would know that, just as I thought
    you would know how to display the same array.

    This is why I suggested in this thread, that,
    if you do not understand the code,
    you should only use a finished product.

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
    Evertjan., Aug 17, 2004
    #7
  8. Tom

    Tom Guest

    On 17 Aug 2004 17:33:44 GMT, Evertjan. wrote:

    >
    > You will need to dim the array beforehand,
    >
    > dim dayMsg(20)
    >
    > I thought you would know that, just as I thought
    > you would know how to display the same array.
    >
    > This is why I suggested in this thread, that,
    > if you do not understand the code,
    > you should only use a finished product.


    Thanks for your help.
    I'm (very) new to ASP, but am willing to learn.

    The need for this calendar is to keep track of the meetings/ clubs etc for
    my kids...

    the 3 of them have more things going on than the rest of my family. :)

    I have got it working using :

    <font size="2"><b><A href="<%=strpage%>"><%=aCalendarDays((iWeek-1)*7 +
    iDay)%></a></font></b><br>
    <%
    ' Checks for a message on the day being written
    strSQL = _

    "SELECT * FROM calendar " &_
    "WHERE calendardate = #" & dtOnDay & "#"
    Set objRS = objConn.Execute(strSQL)
    do until objRS.EOF
    dailyMsg= objRS("calendarText")
    kidsname= objRS("kidsname")
    event= objRS("event")


    Thanks
    Tom, Aug 17, 2004
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. JC
    Replies:
    4
    Views:
    7,953
    Jeff C
    Jul 8, 2004
  2. Replies:
    4
    Views:
    492
    Chris Uppal
    May 5, 2005
  3. KK
    Replies:
    2
    Views:
    528
    Big Brian
    Oct 14, 2003
  4. MuZZy
    Replies:
    7
    Views:
    1,723
    Mike Hewson
    Jan 7, 2005
  5. mera
    Replies:
    7
    Views:
    1,083
Loading...

Share This Page