Gantt Chart in ASP trouble

help's Avatar, Join Date: Feb 2006
Newbie Member
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
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
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
0
coderzone's Avatar, Join Date: Jul 2004
Team Leader
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.
0
help's Avatar, Join Date: Feb 2006
Newbie Member
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
0
help's Avatar, Join Date: Feb 2006
Newbie Member
Sorry again,
I have problem to with gantt chart i made, when I close IE, my IE have error why?
thanks
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
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