%Root=1%> <%current="health" subtitle="health" Id = request("ND_type2nd") '接收首頁使用者點選類別的參數或當下清單post的參數 if Id <> "" then IdArr = Split(Id, "/") MainId = IdArr(0) '使用者點選衛教主類別ID SecondId = IdArr(1) '使用者點選衛教子類別ID end if ND_title = request.form("ND_title") '使用者的標題搜尋 sql = "Select *" 'sql=sql&",convert(varchar(10),ND_StarDate,111) as std_postdate" sql=sql&",PeopleData.ND_Title as peoTypeName" sql=sql&" From PeopleData" sql=sql&" left join PeopleType2nd on PeopleType2nd.ET_ID=PeopleData.ND_Type2nd" 'sql=sql&" where (ND_StarDate is null or ND_StarDate <= '"&Date()&"')" sql=sql&" order by ND_StarDate desc, ND_SID desc" 'Access這邊無法left join兩次 sql2 = "select *" sql2=sql2&" from PeopleData" sql2=sql2&" left join PeopleType2nd on PeopleType2nd.ID=PeopleData.ND_Type2nd" if SecondId <> "" then sql2=sql2&" where PeopleType2nd.ID="&SecondId sql2=sql2&" and ND_Title like '%"&ND_Title&"%'" sql2=sql2&" and now() between ND_StarDate and dateadd('d',1,iif(IsNull(ND_EndDate),now(),ND_EndDate))" else sql2=sql2&" where ND_Title like '%"&ND_Title&"%'" sql2=sql2&" and now() between ND_StarDate and dateadd('d',1,iif(IsNull(ND_EndDate),now(),ND_EndDate))" end if sql2=sql2&" order by ND_StarDate desc, ND_SID desc" const adopenkeyset=1 const adlockreadonly=1 set health_data=Server.CreateObject("ADODB.RECORDSET") health_data.open sql2,conn,adopenkeyset,adlockreadonly %>