2012-12-13 2 views
1

나는 Active Server Page를 가지고 있는데, HTML-Table에 현재 Day의 예약을 표시합니다. Roomname, Organizer, From, To 및 Participants와 같은 정보를 표시합니다.동일한 데이터가 여러 번 표시됩니다. 왜?

내 문제는 예약에서 참가자를 얻으려고하면 해당 예약에 속하지 않아도 특정 예약에 대한 참가자가 여러 예약에 표시된다는 것입니다.

내 문제를 설명하기 위해 :

DailyPlan

는 참가자 "카 시프 버트"또는 "다드"여러 번 표시의 이름을 볼 수 있듯이. 그러나 그들은 단지 "PASS"라는 이름의 예약에 속합니다.

무엇이 문제입니까? 몇 시간 동안 수색했지만 문제는 발견되지 않았습니다. 당신이 나를 도울 수 있기를 바랍니다. 지금까지

내 코드 :

<% 
Dim connection, recordset, sSQL, sConnString, next10, prev10, P 
Dim thema, rsRaum, raum_id, KOPPELBESTUHLUNG_ID, raumname, pageCount 
Dim TeilnehmerNameExtern, TeilnehmerFirmaExtern 

Dim CurrentDate 
CurrentDate = Now() 

Dim intHour 
Dim intMinute 
Dim intSecond 

intHour = 17 
intMinute = 0 
intSecond = 0 

Dim Time 

Time = TimeSerial(intHour, intMinute, intSecond) 

Dim Timeda 
Timeda = Date() 
Dim ts2 
ts2 = Timeda + Time 




Dim DayOfWeek 

DayOfWeek = weekday(CurrentDate) 


If CurrentDate < ts2 Then 



     If DayOfWeek = Weekday(7) Then 

     CurrentDate = DateAdd("d",2,CurrentDate) 

     End If 

     If DayOfWeek = Weekday(1) Then 

     CurrentDate = DateAdd("d",1,CurrentDate) 

     End If 

     If DayOfWeek = Weekday(2) or DayOfWeek = Weekday(3) or DayOfWeek = Weekday(4) or DayOfWeek = Weekday(5) or DayOfWeek = Weekday(6) Then 
     CurrentDate = CurrentDate 
     End If 


    Else If CurrentDate > ts2 Then 

     If DayOfWeek = Weekday(7) Then 

     CurrentDate = DateAdd("d",2,CurrentDate) 

     End If 

     If DayOfWeek = Weekday(1) Then 

     CurrentDate = DateAdd("d",1,CurrentDate) 

     End If 

     If DayOfWeek = Weekday(2) or DayOfWeek = Weekday(3) or DayOfWeek = Weekday(4) or DayOfWeek = Weekday(5)Then 
     CurrentDate = DateAdd("d",1,CurrentDate) 
     End If 

     If DayOfWeek = Weekday(6) Then 
     CurrentDate = DateAdd("d",3,CurrentDate) 
     End If 
End If 
End If 


Set Connection = Server.CreateObject("ADODB.Connection") 
Set Recordset = Server.CreateObject("ADODB.Recordset") 
Set rsRaum = Server.CreateObject("ADODB.Recordset") 



sConnString = "Driver={SQL Server}; Server=localhost; Database=fifa;" 


sSQL="select distinct THEMA, ID, AGENDA, VON, BIS, PERSONENZAHL, THEMA_ENABLED from VIEW_RAUMBUCHUNG_DISPO " & _ 
     "where von >= convert(date, getdate(), 4) " & _ 
     " and von < convert(date, dateadd(day,1, GETDATE()), 4) " & _ 
     " and BIS >= getdate() " & _ 
     " and STORNO is null " & _ 
     " order by von, bis" 




Connection.Open sConnString 
Recordset.open sSQL, sConnString,1,1 


%> 

<html> 

<head> 
<meta http-equiv="content-type" content="text/html;charset=utf-8"/> 
<meta http-equiv="REFRESH" content="10"/> 
<style type="text/css" media="all"> 

body{font-family: Arial;} 
h4{font-size: 10pt;font-weight: bold;white-space: nowrap;margin-top: 0; margin-bottom: 10px;} 
th{font-size: 9pt;font-weight: normal;text-align: center;white-space: nowrap;} 
td{font-size: 9pt;}.content 
td{border: solid 1px #dadada;}.content 
th{border: solid 1px #dadada;background-image: url("tbl_header_row_bg.gif"); background-repeat: repeat-x; white-space: nowrap;} 

</style> 
</head> 

<form name=form1> 

<p align="left" style="margin-top:20px;margin-bottom:20px;font-family:'Arial';font-size:20pt; color:#000000"> Daily Plan </p> 
<p align="left" style="margin-top:10px;margin-bottom:20px;font-family:'Arial';font-size:10pt; color: 
    font-weight:bold;color:#000000"><% =formatDateTime(CurrentDate, 1)%> 
</p> 
</form> 


<table width="100%" class="content" cellpadding="3" cellspacing="0" border="0" style="border-collapse: collapse;"> 



    <tr> 
        <th width="350" align="left">Event</th> 
        <th width="100" align="absmiddle">Room</th> 
        <th width="60" align="absmiddle">From</th> 
        <th width="60" align="absmiddle">To</th> 
        <th align="left">Equipment</th> 
        <th align="left">Catering</th> 
        <th align="left">Agenda</th> 
        <th align="left">Participants</th> 
        <th align="absmiddle">Persons</th> 

    </tr> 


<% 
'If Recordset.EoF Then 
'Response.write "No records to display" 

Do Until Recordset.Eof 


    rsRaum.open "select raum_id, KOPPELBESTUHLUNG_ID from RESERVIERUNGRAUM where buchung_id = " & Recordset("ID"), Connection 
     raum_id = rsRaum("raum_id") 
     KOPPELBESTUHLUNG_ID = rsRaum("KOPPELBESTUHLUNG_ID") 
    rsRaum.close 



    ' falls Kopplung, hole ID des "Parent"-Raumes 
    if not isNull(KOPPELBESTUHLUNG_ID) then 
    rsRaum.open "select parent_id from KOPPELN where CHILD_ID = " & raum_id, Connection 
      if not rsRaum.EOF then 
      raum_id = rsRaum("parent_id") 
      end if 
    rsRaum.close 
    end if 


    'Hole Teilnehmer 

' hole Raum Details 
    rsRaum.open "select bezeichnung from Raum where ID = " & raum_id, Connection 

     raumname = rsRaum("bezeichnung") 

    rsRaum.close 


    rsRaum.open "SELECT DISTINCT NAME, FIRMA FROM TEILNEHMER WHERE buchung_id = " & Recordset("ID") & " and STATUS = 2 and DAILYPLAN = 1" , Connection 

      if not rsRaum.EOF then 

      dim new_list 
      new_list = "" 

      do while not rsRaum.eof 



       new_list = new_list & rsRaum("NAME") & " " & "(" & rsRaum("FIRMA") & ")" & "," 


      rsRaum.movenext 



      loop 
      new_list = left(new_list, len(new_list)-1) 

     end if 


    rsRaum.close 

    rsRaum.open "SELECT DISTINCT TRIGRAM FROM TEILNEHMER WHERE buchung_id = " & Recordset("ID") & " and STATUS = 1 and DAILYPLAN = 1" , Connection 

     Response.Write(rsRaum.recordcount) 

      if not rsRaum.EOF then 

      dim new_list2 
      new_list2 = "" 

      do while not rsRaum.eof 



       new_list2 = new_list2 & rsRaum("TRIGRAM") & "," 


      rsRaum.movenext 



      loop 
      new_list2 = left(new_list2, len(new_list2)-1) 

     end if 


    rsRaum.close 

    rsRaum.Open "SELECT distinct d.Bezeichnung, rd.Bestellmenge " & _ 
             "FROM RESERVIERUNGDIENSTLEISTUNG rd " & _ 
             "JOIN DIENSTLEISTUNG d ON rd.DIENSTLEISTUNG_ID = d.ID " & _ 
             "JOIN RESERVIERUNGRAUM rr ON rd.RESERVIERUNGRAUM_ID = rr.ID " & _ 
             "JOIN DIENSTLEISTUNGSART dlart ON d.DIENSTLEISTUNGSART_ID = dlart.ID " & _ 
             "JOIN ABRECHNUNGSGRUPPE ab ON dlart.ABRECHNUNGSGRUPPE_ID = 3 " & _ 
             "JOIN BUCHUNG b ON rr.BUCHUNG_ID = " & Recordset("ID"), Connection 

      if not rsRaum.EOF then 

      dim new_list3 
      new_list3 = "" 

      do while not rsRaum.eof 



       new_list3 = new_list3 & rsRaum("Bezeichnung") & "," 


      rsRaum.movenext 



      loop 
      new_list3 = left(new_list3, len(new_list3)-1) 

     end if        

rsRaum.close 





if ucase(Recordset("thema_enabled")) = "Y" or isnull(Recordset("thema_enabled")) then 
    thema = Recordset("THEMA") 
    else 
    thema = "" 
    end if 


%> 

    <tr "margin-bottom:100px" height="30" valign="top"> 
    <td style="overflow:hidden;"><% =thema %></td> 
    <td align="center"; ><% =raumname %><br></td> 
    <td align="center"; ><% =FormatDateTime(Recordset("von"), 4)%></td> 
    <td align="center"; ><% =FormatDateTime(Recordset("bis"), 4) %></td> 
    <td align="center"; ><br></td> 
    <td align="center"; ><% =new_list3 %><br></td> 
    <td align="center"; ><% =Recordset("agenda") %></td> 
    <td ><% =new_list%><br><% =new_list2%><br></td> 
    <td align="center"; ><% =Recordset("personenzahl") %><br></td> 
    </tr> 


<% 



Recordset.MoveNext 
Loop 
'End If 



Recordset.Close 
Set Recordset = Nothing 
Connection.Close 
Set Recordset = Nothing 

%> 


</table> 
</body> 
</html> 
+0

흠에서 삭제되지 않습니다이다, 아니, 난 모든 값을 삭제하지 않습니다. 당신이 언급 한 것을 어떻게 할 수 있습니까? – Paks

+0

내 질문을 업데이트하고 전체 코드를 게시했습니다 – Paks

+1

'Dim' 문을 페이지의 맨 위로 옮기고'new_list = ""와'new_list2 = ""'각각의'if rs.eof' 체크 전에 – SearchAndResQ

답변

1

문제는 new_listnew_list2의 값이 각 반복

관련 문제