Go4Expert

Go4Expert (http://www.go4expert.com/)
-   ASP (http://www.go4expert.com/forums/asp/)
-   -   Gantt Chart in ASP trouble (http://www.go4expert.com/forums/gantt-chart-asp-trouble-t581/)

help 9Feb2006 07:18

Gantt Chart in ASP trouble
 
Hallo,
Sorry but i want to ask about gantt chart in asp,
why from my code in asp is wasting time and make connetion timeout,
is a cut from my code, have you some solution to me.
i use Oracle database, and the memory server is 4Gbytes
thanks

tglawal=fun_tgl_awal(vartahun,varblnawal)
tglakhir=fun_tgl_akhir(vartahun,varblnakhir)

Response.Write("<span class='style11'>"&varkd_mesin_ip&" Periode : "&lblbulan(varblnawal)&"-"&lblbulan(varblnakhir)&" "&vartahun&"<br></span>")

'ini buat next yang dibawah
test=cint(tglakhir-tglawal)
for x=0 to test

for li = 0 to 1440 step 1
test_tglx=dateadd("s",li*60,tglawal)


if is_true(test_tglx,"P") then
Response.Write("<td bgcolor='#FFFF00'><img src='bgsm.gif' height='5' width='1'></td>")
'Response.Write("<td bgcolor=yellow>-</td>")
else
Response.Write("<td bgcolor='#CCCCCC'><img src='bgsm.gif' height='5' width='1'></td>")
end if
next
response.Write("</tr>")

tglawal=dateadd("d",1,tglawal)
next

function is_true(tglwaktu,state)
if line > 0 then
for slot_state=1 to line
if slot_state<line then
if ( array_sm(1,slot_state) = state) and (array_sm(2,slot_state) <= tglwaktu) and (tglwaktu <= array_sm(2,slot_state+1)) then
is_true = true
exit for
else
is_true = false
end if
else
if ( array_sm(1,slot_state) = state) and (array_sm(2,slot_state) <= tglwaktu) then
is_true = true
exit for
else
is_true = false
end if
end if
next
else
is_true = false
end if
end function

function fun_tgl_awal(tahun,bulanawal)
fun_fun_tgl_awal=cdate(bulanawal&"/1/"&tahun&" 00:00")
end function

function fun_tgl_akhir(tahun,bulanakhir)
fun_fun_tgl_akhir=cdate(bulanakhir&"/"&lbllentgl(bulanakhir)&"/"&tahun&" 23:59")
end function

shabbir 9Feb2006 10:49

Re: Gantt Chart in ASP trouble
 
I have moved your thread to the Queries and expert comments section from Codes and Project Section

Also I have formated your code so that its easy to understand. You can also use the bbcode to do the same

Code: ASP

tglawal=fun_tgl_awal(vartahun,varblnawal)
tglakhir=fun_tgl_akhir(vartahun,varblnakhir)

Response.Write("<span class='style11'>"&varkd_mesin_ip&" Periode : "&lblbulan(varblnawal)&"-"&lblbulan(varblnakhir)&" "&vartahun&"<br></span>")

'ini buat next yang dibawah
test=cint(tglakhir-tglawal)
for x=0 to test

for li = 0 to 1440 step 1
test_tglx=dateadd("s",li*60,tglawal)


if is_true(test_tglx,"P") then
        Response.Write("<td bgcolor='
#FFFF00'><img src='bgsm.gif' height='5' width='1'></td>")
        '
Response.Write("<td bgcolor=yellow>-</td>")
else
        Response.Write("<td bgcolor='#CCCCCC'><img src='bgsm.gif' height='5' width='1'></td>")
end if
next
response.Write("</tr>")

tglawal=dateadd("d",1,tglawal)
next

function is_true(tglwaktu,state)
if line > 0 then
        for slot_state=1 to line
                if slot_state<line then
                        if ( array_sm(1,slot_state) = state) and (array_sm(2,slot_state) <= tglwaktu) and (tglwaktu <= array_sm(2,slot_state+1)) then
                                is_true = true
                                exit for
                        else
                                is_true = false
                        end if
                else
                        if ( array_sm(1,slot_state) = state) and (array_sm(2,slot_state) <= tglwaktu) then
                                is_true = true
                                exit for
                        else
                                is_true = false
                        end if
                end if
        next
else
        is_true = false
end if
end function

function fun_tgl_awal(tahun,bulanawal)
fun_fun_tgl_awal=cdate(bulanawal&"/1/"&tahun&" 00:00")
end function

function fun_tgl_akhir(tahun,bulanakhir)
fun_fun_tgl_akhir=cdate(bulanakhir&"/"&lbllentgl(bulanakhir)&"/"&tahun&" 23:59")
end function


coderzone 9Feb2006 10:56

Re: Gantt Chart in ASP trouble
 
It looks like the problem is in the following statement
Code: ASP

for slot_state=1 to line

You are looping it from 1 to a variable line which is not defined or initilized so probably it loops infinitely and then terminates.

help 10Feb2006 07:04

Re: Gantt Chart in ASP trouble
 
sorry line from this code
line show how many row in the select execution,
thanks

do while(not rs.eof)
line=line+1
rs.movenext
loop

help 10Feb2006 09:04

Re: Gantt Chart in ASP trouble
 
Sorry again,
I have problem to with gantt chart i made, when I close IE, my IE have error why?
thanks

shabbir 10Feb2006 10:23

Re: Gantt Chart in ASP trouble
 
Code: ASP

do while(not rs.eof)
line=line+1
rs.movenext
loop

But you havent done that on the page code and so it should be infinte.

Also what error you get in IE. If its your IE causing the problems try getting FireFox


All times are GMT +5.5. The time now is 00:20.