N
Navin
hi,
i am using the follwoing code to write a recordset to a csv file
'fcreateFile -file system object
Do While Not oRs.EOF
fcreateFile.Write(oRs.GetString(,1000,",",vbcrlf,"")) 'Write Login
Info
loop
to write the data to csv fle
the sql retuns the data in few seconds but at asp file whehn i cma
writing data to the csv file using the getsring method to generate a
comma soeperated file
then it just hangs if the no of records is more than 10,000
i tried alot of things ultimate this piece of code was giving hassles
if the data is returned in 5 sec it takes around 10 minutes for
writing to the csv file
can you can help me ou how to correct this piece code
for yrt ref my whole code of file genearion is given below
'Download base Summary-----------------------------
<%'-------------------------Title------------------------
On Error Resume Next
'----------------File System
Object----------------------------------------------
Set fs = Server.CreateObject("Scripting.FileSystemObject")
if fs.FileExists(server.MapPath(".") & "\Download\" & strfilename) =
true then
'set fcreateFile = fs.OpenTextFile(server.MapPath(".") &
"\Download\" & strfilename , 2,true)
sFileExists=true
else
Set fcreateFile = fs.CreateTextFile(server.MapPath(".") &
"\Download\" & strfilename ,True)
end if
'-----------RecordSet-----------------------------------
If Err.number <> 0 Then%>
<script>
alert("File-"+'<%=strfilename%>'+"Already Opened."+"\n"+"Please
Close the File and then Click on the Link")
</script>
<%Set fcreateFile=nothing
Response.End
end if
'----------------------Com Object------------------------
set objUtility = Server.CreateObject(objUtilityName)
'-------------------RecordSet---------------------------
Set oRs = Server.CreateObject("ADODB.RecordSet")
'-----------------------Login
Info----------------------------------------------
sLOginInfo="," & "DOWNLOAD BASE SUMMARY REPORT" & vbcrlf & vbCrLf &
_
"Period:" & "," & nProcessMonth & " (" & sMonthName & ")" &
vbcrlf & _
sPersonName & vbcrlf & _
"CCAT ID:" &"," & CStr(nCcatId) & vbcrlf & vbcrlf
fcreateFile.Write(sLOginInfo) 'Write Login Info
'-----------------------------
ssql="some sql query"
Set oRs = objUtility.fncRunSQLReturnRS(sSql)
IF oRs.EOF=false then
sHeader="Manager"& "," & "Person" & "," & "Agent" & "," & "SAC
Code"& "," & _
"SAC Name"&","& "From Period" &"," &"To Period"&"," & _
"Revenue Stream"&","& "Current YTD" &"," & _
"Last YTD " &","& "YTD Target" & "," & _
"% Ach YTD" & "," &_
"Last Yr Full" &"," & _
"Full Target" &"," & "% Ach Full"& "," & _
"Growth %"& vbcrlf
fcreateFile.Write(sHeader) 'Header String
fcreateFile.Write(oRs.GetString(,,",",vbcrlf,"") ) 'Manager Sac
Data
Do While Not oRs.EOF
fcreateFile.Write(oRs.GetString(,1000,",",vbcrlf,"")) 'Write Login
Info
Loop
fcreateFile.Write(vbCrLf )
end if
oRs.Close
set oRs=nothing
set objUtility=nothing
fcreateFile.Close
Set fs=Nothing
%>
i am using the follwoing code to write a recordset to a csv file
'fcreateFile -file system object
Do While Not oRs.EOF
fcreateFile.Write(oRs.GetString(,1000,",",vbcrlf,"")) 'Write Login
Info
loop
to write the data to csv fle
the sql retuns the data in few seconds but at asp file whehn i cma
writing data to the csv file using the getsring method to generate a
comma soeperated file
then it just hangs if the no of records is more than 10,000
i tried alot of things ultimate this piece of code was giving hassles
if the data is returned in 5 sec it takes around 10 minutes for
writing to the csv file
can you can help me ou how to correct this piece code
for yrt ref my whole code of file genearion is given below
'Download base Summary-----------------------------
<%'-------------------------Title------------------------
On Error Resume Next
'----------------File System
Object----------------------------------------------
Set fs = Server.CreateObject("Scripting.FileSystemObject")
if fs.FileExists(server.MapPath(".") & "\Download\" & strfilename) =
true then
'set fcreateFile = fs.OpenTextFile(server.MapPath(".") &
"\Download\" & strfilename , 2,true)
sFileExists=true
else
Set fcreateFile = fs.CreateTextFile(server.MapPath(".") &
"\Download\" & strfilename ,True)
end if
'-----------RecordSet-----------------------------------
If Err.number <> 0 Then%>
<script>
alert("File-"+'<%=strfilename%>'+"Already Opened."+"\n"+"Please
Close the File and then Click on the Link")
</script>
<%Set fcreateFile=nothing
Response.End
end if
'----------------------Com Object------------------------
set objUtility = Server.CreateObject(objUtilityName)
'-------------------RecordSet---------------------------
Set oRs = Server.CreateObject("ADODB.RecordSet")
'-----------------------Login
Info----------------------------------------------
sLOginInfo="," & "DOWNLOAD BASE SUMMARY REPORT" & vbcrlf & vbCrLf &
_
"Period:" & "," & nProcessMonth & " (" & sMonthName & ")" &
vbcrlf & _
sPersonName & vbcrlf & _
"CCAT ID:" &"," & CStr(nCcatId) & vbcrlf & vbcrlf
fcreateFile.Write(sLOginInfo) 'Write Login Info
'-----------------------------
ssql="some sql query"
Set oRs = objUtility.fncRunSQLReturnRS(sSql)
IF oRs.EOF=false then
sHeader="Manager"& "," & "Person" & "," & "Agent" & "," & "SAC
Code"& "," & _
"SAC Name"&","& "From Period" &"," &"To Period"&"," & _
"Revenue Stream"&","& "Current YTD" &"," & _
"Last YTD " &","& "YTD Target" & "," & _
"% Ach YTD" & "," &_
"Last Yr Full" &"," & _
"Full Target" &"," & "% Ach Full"& "," & _
"Growth %"& vbcrlf
fcreateFile.Write(sHeader) 'Header String
fcreateFile.Write(oRs.GetString(,,",",vbcrlf,"") ) 'Manager Sac
Data
Do While Not oRs.EOF
fcreateFile.Write(oRs.GetString(,1000,",",vbcrlf,"")) 'Write Login
Info
Loop
fcreateFile.Write(vbCrLf )
end if
oRs.Close
set oRs=nothing
set objUtility=nothing
fcreateFile.Close
Set fs=Nothing
%>