Classic ASP Datatables
Classic ASP Datatables
sharmanic2002
Posts: 2Questions: 0Answers: 0
Dear Great Gurus
I am using Classic ASP Datatables with json to fetch data .
My issues are
1) Datatables are not Refreshed.
2) A Very Slow response of Datatables(I have 10000+ Records in the table.)
Please help me in winning this situation..Thanks in Advance
Below is my Code.
[CODE]
var oCache = {
iCacheLower: -1
};
function fnSetKey( aoData, sKey, mValue )
{
for ( var i=0, iLen=aoData.length ; i 0 then
order = Right(order, Len(order)-1)
Else
End If
strOrderBy = " ORDER BY " & order
if isnull(trim(order)) or trim(order) = "" then
strOrderBy = " ORDER BY 1"
Else
End If
Set Session("objConn") = Server.CreateObject("ADODB.Connection")
strConnection = "Provider=MSDAORA;Data Source=PERS;User Id=ITMAN;Password=ITMAN;"
Session("objConn").open strConnection
SQL = "select COL1, COL2, , COL3, COL4, COL5,COL6 from PERSTBL " & strWhere & " and IS_DELETED <> 'Y' "& strOrderBy
Set rs = Session("objConn").Execute(SQL)
'Response.Write sql
'Response.Write date()
'Response.Write tstr
iTotalDisplayRecords = 0
if rs.eof = false then
do while not rs.eof
iTotalDisplayRecords = iTotalDisplayRecords + 1
rs.movenext
loop
rs.movefirst
end if
SQL2 = "SELECT count(*) FROM PERSTBL where IS_DELETED <> 'Y'"
Set rs2 = Session("objConn").Execute(SQL2)
iTotalRecords = rs2(0)
%>
{"sEcho": <%=sEcho%>, "iTotalRecords": <%=iTotalRecords%>, "iTotalDisplayRecords": <%=iTotalDisplayRecords%>, "aaData": [
<% i= 0
if rs.eof = false then
rs.move(iDisplayStart)
do while i < iDisplayLength and not rs.eof
tstr = Left(rs("COL5"),100)
if isnull(rs("DEP_ON_LIVE")) or rs("DEP_ON_LIVE") = "N" then
set_typ = " - (U)"
Else
End If
if rs("DEP_ON_LIVE") = "Y" then
set_typ = " - (P)"
set_typ1 = "REVERT " & set_typ
Else
set_typ1 = "TO LIVE | REVERT " & set_typ
End If
if rs("IS_REVERTED") = "Y" then
set_typ = " - (R)"
set_typ1 = "TO LIVE | REVERT " & set_typ
Else
End If
aaData = aaData + "['" & rs("COL1") & "','"& rs("COL3") &"','" & rs("COL4") & "','" & rs("COL2") & "','" & tstr & "','"& set_typ1 &"'],"
aaData = Replace(aaData,"'",chr(34))
rs.movenext
i=i+1
loop
aaData = Left(aaData,Len(aaData)-1)
else
aaData = ""
end if
response.write aaData & "] }"
%>
[/CODE]
I am using Classic ASP Datatables with json to fetch data .
My issues are
1) Datatables are not Refreshed.
2) A Very Slow response of Datatables(I have 10000+ Records in the table.)
Please help me in winning this situation..Thanks in Advance
Below is my Code.
[CODE]
var oCache = {
iCacheLower: -1
};
function fnSetKey( aoData, sKey, mValue )
{
for ( var i=0, iLen=aoData.length ; i 0 then
order = Right(order, Len(order)-1)
Else
End If
strOrderBy = " ORDER BY " & order
if isnull(trim(order)) or trim(order) = "" then
strOrderBy = " ORDER BY 1"
Else
End If
Set Session("objConn") = Server.CreateObject("ADODB.Connection")
strConnection = "Provider=MSDAORA;Data Source=PERS;User Id=ITMAN;Password=ITMAN;"
Session("objConn").open strConnection
SQL = "select COL1, COL2, , COL3, COL4, COL5,COL6 from PERSTBL " & strWhere & " and IS_DELETED <> 'Y' "& strOrderBy
Set rs = Session("objConn").Execute(SQL)
'Response.Write sql
'Response.Write date()
'Response.Write tstr
iTotalDisplayRecords = 0
if rs.eof = false then
do while not rs.eof
iTotalDisplayRecords = iTotalDisplayRecords + 1
rs.movenext
loop
rs.movefirst
end if
SQL2 = "SELECT count(*) FROM PERSTBL where IS_DELETED <> 'Y'"
Set rs2 = Session("objConn").Execute(SQL2)
iTotalRecords = rs2(0)
%>
{"sEcho": <%=sEcho%>, "iTotalRecords": <%=iTotalRecords%>, "iTotalDisplayRecords": <%=iTotalDisplayRecords%>, "aaData": [
<% i= 0
if rs.eof = false then
rs.move(iDisplayStart)
do while i < iDisplayLength and not rs.eof
tstr = Left(rs("COL5"),100)
if isnull(rs("DEP_ON_LIVE")) or rs("DEP_ON_LIVE") = "N" then
set_typ = " - (U)"
Else
End If
if rs("DEP_ON_LIVE") = "Y" then
set_typ = " - (P)"
set_typ1 = "REVERT " & set_typ
Else
set_typ1 = "TO LIVE | REVERT " & set_typ
End If
if rs("IS_REVERTED") = "Y" then
set_typ = " - (R)"
set_typ1 = "TO LIVE | REVERT " & set_typ
Else
End If
aaData = aaData + "['" & rs("COL1") & "','"& rs("COL3") &"','" & rs("COL4") & "','" & rs("COL2") & "','" & tstr & "','"& set_typ1 &"'],"
aaData = Replace(aaData,"'",chr(34))
rs.movenext
i=i+1
loop
aaData = Left(aaData,Len(aaData)-1)
else
aaData = ""
end if
response.write aaData & "] }"
%>
[/CODE]
This discussion has been closed.