<%
'On Error Resume Next '*** Not Show ASP Error ***'
Dim Conn,strSQL,strSQL1,objRec,objRec1,Conn1,strSQLAdd,a,day,num,ddate
Set Conn = Server.Createobject("ADODB.Connection")
Conn.Open "Driver={SQL Server};Server=FILEIO\SSA_TEST;Database=ssa;UID=sa;PWD=999sa;"
strSQL1 = "Select * From LVHOLIDAY"
Set objRec1 = Server.CreateObject("ADODB.Recordset")
objRec1.Open strSQL1, Conn,1,3
ddate ="6/7/2552"
day = Holiday(ddate)
If day = "" Then
num = Weekday(ddate,1)
If num = 1 Then
day ="วันหยุด"
ElseIf num = 7 Then
day ="วันหยุด"
Else
day =""
End If
End If
Response.write ddate&" is "&day
Function Holiday(ByRef dateh)
Dim dateholi,desc
Do While Not objRec1.EOF
dateholi = Split(objRec1.Fields("holi_date").value," ")
If dateh = dateholi(0) Then
desc = objRec1.Fields("holi_desc").value
Return desc
End If
objRec1.MoveNext
Loop
End Function
%>
Function Holiday(ByRef dateh)
Dim dateholi,desc
Do While Not objRec1.EOF
dateholi = Split(objRec1.Fields("holi_date").value," ")
If dateh = dateholi(0) Then
desc = objRec1.Fields("holi_desc").value
Holiday = desc
End If
objRec1.MoveNext
Loop