|
|
||||||
|
#1
|
|
|
|
|
I have an app that gets data from SQL Server and writes it to a csv
file. My problem is that my query returns 25K + records. IE seems to 'hang' and the csv file never gets created. Any Ideas how I can get this to work? Below is my code: Response.Expires = -1 Response.Buffer = True 'Response.ContentType="application/vnd.ms-excel" Server.ScriptTimeout = 10000 fileName2 = createGUID() filesavepath2 = rootDir &"\assets\docs\"&Request.Cookies("supplypoint")("m epSite")&"_personnel.csv" headerRow = "" headerRow = headerRow & "SupplyPoint ID, Org Name, Title, Title2, Job Function, Prefix, First Name, Middle, Last Name," headerRow = headerRow & "Suffix, Extended Info, Email, Phone" dataRows = "" 'FOR STORED PROCEDURE BEGIN strsql = "sp_exportKeyPersonnel '" & mepId & "', '" & showType & "'" Set rs = DB.Execute (strsql) 'FOR STORED PROCEDURE END While (NOT rs.EOF) currentOrgId = rs("id") dataRows = dataRows & """" & rs("msccId") & """,""" & rs("name") &""",""" & rs("title") &""",""" & rs("title2") &""",""" & rs("jFunction") &""",""" & rs("prefix") &""",""" & rs("firstName") &"""," dataRows = dataRows & """" & rs("MI") &""",""" & rs("lastName") &""",""" & rs("suffix") &""",""" & rs("extendedInfo") &"""," dataRows = dataRows & """" & rs("email") &""",""" & rs("phone") &"""" dataRows = dataRows & ""&vbcrlf&"" rs.MoveNext() Wend rs.close Set rs = Nothing Set DB = Nothing set FSO = Server.CreateObject("scripting.FileSystemObject") set csvfile = fso.CreateTextFile(filesavepath2, true) csvfile.WriteLine(headerRow & vbcrlf) csvfile.WriteLine(dataRows) csvfile.Close Ariel |
|
|
|
#2
|
|
|
|
|
Your page will be timing out as you move through your recordset. As it
times out and all you are doing is concatinating lots of text nothing appears to have been done. The way you are adding to the same variable is incredibly slow and inneficient. Rather than creating one big var then writing it to FSO in one go, open your file then write to it line by line and it'll be quicker. Hopefully enough to complete before it times out. "A.S." <xweb_10> wrote in message news:3176 [..] |
|
#3
|
|
|
|
|
I will try that out.
Remember, it is not timing out, just hanging. Very odd behavior. Ariel Adrian Forbes [ASP MVP] wrote: [..] |
|
#4
|
|
|
|
|
Maybe this then
http://www.aspfaq.com/show.asp?id=2180 "A.S." <ashmorak> wrote in message news:3200 [..] |
|
#5
|
|
|
|
|
Definitely not antivirus.
Adrian Forbes [ASP MVP] wrote: [..] |
|
|
| Similar Threads | |
| Export ERD to SQL Server All, I'm using Visio 2007 to create an Entity Relationship Diagram (ERD) model for a DB. Now, I'm having a hard time to get these tables and relationship import into SQL... |
|
| Export big Public Folders from old server to a new server Hi, Can anyone help me with this? On our old server windows 2000 with exchange 2000 we have a big public folders (16GB) Does someone knows an easy way to 'copy' this public... |
|
| Can I share a Web Server certificate by export with provate key and import to another server Hi, I have two IIS server at two location , all having the same content . If I have a certificate on Server A , can I export both the certificate and its private key and... |
|
| Export data from SQL Server 2000 into SQL Server CE Hi, I am developing PPC application using SQL Server 2000 and SQL Server CE 2.0. I succeeded in getting/pulling data from handheld/sql server ce into sql server 2000 using... |
|
| SQL Server Export to CSV I have developed an ASP web page that builds a select from a SQL Server database based on the user's criteria and displays the results in an HTML table. I am trying to give... |
|
|
All times are GMT. The time now is 01:21 PM. | Privacy Policy
|