Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 2nd, 2005, 09:23 PM
Authorized User
 
Join Date: Dec 2004
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default runtime error 800a0009 on calendar

Need extreme help regarding the calendar i am using. error started on jan. 27/28 maybe regarding 31 days in january and 28 days in february. one other thing, calend set for ms access and i converted to sql server.

below code that might be problem. i am stuck!!!

<%
dim objRs, objCon, dtToday

' open the database
set objCon= Server.CreateObject("ADODB.Connection")
objCon.Open strCon

cat = Request.QueryString("cat")
if cat = "" then
    cat = "all"
End If

'Write a select box
Sub DropDown(tbl, valField, selVal, Field)
    set rsDrop = Server.CreateObject("ADODB.Recordset")
    strSQL = "SELECT DISTINCT " & valField & ", " & Field & " FROM " & tbl & _
        " ORDER BY " & field
    rsDrop.Open strSQL, objCon
    Response.Write "<option value=1>Select...</option>"
    do until rsDrop.EOF
        Response.Write "<option value='"
        Response.Write rsDrop(valfield) & "'"
        Response.Write ">" & rsDrop(field) & "</option>" & vbcrlf
        rsDrop.MoveNext
    loop
    rsDrop.Close
    set rsDrop=nothing
end sub

' Format the ouput
Function FormatStr(String)
    on Error resume next
    String = Replace(String, CHR(13), "")
    String = Replace(String, CHR(10) & CHR(10), "</P><P>")
    String = Replace(String, CHR(10), "<BR>")
    FormatStr = String
End Function

function dNum(n)
    if n >= 10 then
        dNum = cstr(n)
    Else
        dNum = "0" & cstr(n)
    End If
End Function

'SQL Formatted Date
Function SQLDate(dt)
    SQLDate = cdbl(dt) ' Year(dt) & "-" & DNum(Month(dt)) & "-" & Dnum(Day(dt)) & " " & dnum(hour(dt)) & ":" & dnum(Minute(dt))
End Function

' Get the previous sundays date
Function DtPrevSunday(ByVal dt)
    Do While WeekDay(dt) > vbSunday
        dt = DateAdd("d", -1, dt)
    Loop
    DtPrevSunday = dt
End Function

'Todays Date
dtToday = Date()

Dim dtCurViewMonth ' First day of the currently viewed month
Dim dtCurViewDay ' Current day of the currently viewed month
Dim frmDate ' Date submitted by form

' if the GO button was used, build the date from the month and year
If InStr(1, Request.Form, "subGO", 1) > 0 then
    if Request.Form("CURDATE_month") = "" then
        tmpMonth = month(now())
    else
        tmpMonth = Request.Form("CURDATE_month")
    End If

    if Request.Form("CURDATE_year") = "" then
        tmpyear = year(now())
    else
        tmpyear = Request.Form("CURDATE_year")
    End If

    tmpDate = "1 " & tmpMonth & " 1999"

    mnth = Month(tmpDate)
    frmDate = DateSerial(tmpyear, mnth, 1)
Else
    frmDate = Request.Form("CURDATE")
end if


if Request("view_date") <> "" then
    frmDate= DateSerial(year(Request("view_date")), month(Request("view_date")), 1)
end if


' if posted from the form
' if prev button was hit on the form
   If InStr(1, Request.Form, "subPrev", 1) > 0 Then
      dtCurViewMonth = DateAdd("m", -1, frmDate)
' if next button was hit on the form
   ElseIf InStr(1, Request.Form, "subNext", 1) > 0 Then
      dtCurViewMonth = DateAdd("m", 1, frmDate)
' anyother time
      Else
' date add in text box
         If InStr(1, Request.Form, "subGO", 1) > 0 then
            dtCurViewMonth = frmDate
         Else
            if Request("view_date") <> "" then
                dtCurviewMonth = frmDate
            else
            dtCurViewMonth = DateSerial(Year(dtToday), Month(dtToday), 1)
            End If
         End If
   End If


Dim iDay, iWeek, sFontColor, dictDte(31,2), intCount
strSQL ="SELECT diary.id, diary.dte, diary.text_field, Diary_Categorys.Category, Diary_Categorys.Colour, Diary_Categorys.BgColour" & _
        " FROM Diary_Categorys RIGHT JOIN diary ON Diary_Categorys.Cat_ID = diary.Category " & _
        " WHERE month(diary.dte)= " & month(dtCurViewMonth) & " and year(diary.dte) = " & year(dtCurViewMonth)

if cat <> "all" then
    strSQL = strSQL & " AND Diary_Categorys.Cat_ID = " & cat
End If
strSQL = strSQL & " order by diary.dte"

set objRs = objCon.Execute (StrSql)
intCount= 0

' populate array with days of month
tmpDay = ""

do until objRs.EOF
    if day(objRs("dte")) = tmpDay then
            lnk = "<a href=diary_view.asp?id=" & objRs("id") & " style='color:" & objRs("colour") & _
                "; background:" & objRs("BgColour") & ";" & "font-family:verdana;font-size:8pt;line-height:15px' title='" & cdate(objRs("dte")) & "'>" &_
                objRs("text_field") & "</a>"

            dictDte(intCount-1, 1) = dictDte(intCount-1, 1) & "<br>" & lnk
               tmpDay = day(objRs("dte"))
            objRs.Movenext
    Else
        if Day(objRs("dte")) = intCount + 1 then
            lnk = "<a href=diary_view.asp?id=" & objRs("id") & " style='color:" & objRs("colour") & _
                "; background-color:" & objRs("BgColour") & ";" & "font-family:verdana;font-size:8pt;line-height:15px' title='" & cdate(objRs("dte")) & "'>" &_
                objRs("text_field") & "</a>"
            dictDte(intCount, 1) = lnk
            tmpDay = day(objRs("dte"))
            objRs.Movenext
            intCount = intCount + 1
        Else
            dictDte(intCount, 1) = " "
            intCount = intCount + 1
        End If
        dictDte(intCount, 2) = intCount + 1
    End if
loop

Mike
__________________
Mike





Similar Threads
Thread Thread Starter Forum Replies Last Post
Error in Monthly Calendar Report (Ch9) mruschetti BOOK: Expert Access 2007 Programming ISBN 978-0-470-17402-9 6 May 7th, 2008 11:43 PM
hi i got runtime error 13 Type Mismatch error sriharsha345 Access VBA 2 February 21st, 2008 09:30 AM
Error on Zapatec.Calendar.setup script cJeffreywang ASP.NET 2.0 Basics 4 December 14th, 2007 02:30 PM
mysterious error runtime error '451' coyotworks Excel VBA 1 May 12th, 2006 03:57 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.