dato hjelp!!
jeg har ned sql tabell med et dato felt som er date().Jeg får bare 0000-00-00 i feltet når jeg bruker dette skriptet.
scriptet har vært brukt til access for og jeg har tydeligvis ikke klart å skrive det helt om.
Kan noen hjelpe?
<!--#INCLUDE FILE="dbcon.asp" -->
<%
Session.LCID = 2057
'--------------------------------------------------
Function DtPrevSunday(ByVal dt)
Do While WeekDay(dt) > vbSunday
dt = DateAdd("d", -1, dt)
Loop
DtPrevSunday = dt
End Function
'--------------------------------------------------
Sub diary(dtView)
Dim dtToday
dtToday = Date()
Dim dtCurViewMonth ' First day of the currently viewed month
Dim dtCurViewDay ' Current day of the currently viewed month
' Get first day of month
dttmp = dtView
dtday = day(dttmp)
dttmp = dateadd("d", (-dtday+1), dttmp)
dtCurViewMonth = dttmp
Dim iDay, iWeek, sFontColor
%>
<TABLE CELLPADDING=3 CELLSPACING=0 WIDTH="95%" BORDER=2 BGCOLOR="#99CCFF" BORDERCOLORDARK="#003399" BORDERCOLORLIGHT="#FFFFFF">
<TR VALIGN=MIDDLE ALIGN=CENTER>
<TD COLSPAN=7>
<TABLE CELLPADDING=0 CELLSPACING=0 WIDTH="100%" BORDER=0>
<TR VALIGN=MIDDLE ALIGN=CENTER>
<TD WIDTH="10%" ALIGN=center>
<a href="view_day.asp?view_date=<%= dateadd("m", -1, dtCurViewMonth) %>"><</a>
</TD>
<TD WIDTH="80%">
<FONT FACE="Arial" COLOR="#000000">
<B><small><%=Monthname(Month(dtCurViewMonth)) & " " & Year(dtCurViewMonth)%></small></B>
</FONT>
</TD>
<TD WIDTH="10%" ALIGN=center>
<a href="view_day.asp?view_date=<%= dateadd("m", 1, dtCurViewMonth) %>">></a>
</TD>
</TR>
</TABLE>
</TD>
</TR>
<TR VALIGN=TOP ALIGN=CENTER BGCOLOR="#000099">
<% For iDay = vbSunday To vbSaturday %>
<TH WIDTH="14%"><FONT FACE="Arial" SIZE="-2" COLOR="#FFFFFF"><%=left(WeekDayName(iDay), 3)%></FONT></TH>
<%Next %>
</TR>
<%
dtCurViewDay = DtPrevSunday(dtCurViewMonth)
For iWeek = 0 To 5
Response.Write "<TR VALIGN=TOP>" & vbCrLf
Dim sBGCOLOR
sBGCOLOR = "#99ccff"
For iDay = 0 To 6
sBGCOLOR = "#99ccff"
If month(dtCurViewDay) = month(dtCurViewMonth) Then
If dtCurViewDay = dtToday Then sBGCOLOR = "#99ccbb"
else
sBGCOLOR = "#99ccff"
End If
Response.Write "<TD HEIGHT=20 bgcolor='" & sBGCOLOR & "' >"
If month(dtCurViewDay) = month(dtCurViewMonth) Then
If dtCurViewDay = dtToday Then
sFontColor = "#ff0000"
Else
sFontColor = "#00000"
End If
Response.Write "<FONT FACE=""Arial"" SIZE=""-2"" COLOR=""" & sFontColor & """><B>"
Response.Write "<a href=view_day.asp?" & "view_date=" & year(dtCurViewday) & "-" & monthname(month(dtCurViewday)) & "-" & day(dtCurViewday) & ">" & Day(dtCurViewDay) & "</a></B></FONT><BR>"
End If
Response.Write "</TD>" & vbCrLf
dtCurViewDay = DateAdd("d", 1, dtCurViewDay)
Next
Response.Write "</TR>" & vbCrLf
Next
%>
<%
' --------END OF DRAW CALENDAR SECTION--------
Response.Write "</table>"
End Sub
%>
<%
set my_conn= Server.CreateObject("ADODB.Connection")
my_Conn.Open DBcon
StrSql= "Select * from bk.diary where dte = '" & Request("view_Date") & "' ORDER BY dte"
rs = my_conn.Execute (StrSql)
' If no records found then no worries just trap error
on Error Resume next
%>
