Solved

CSV Download data

Posted on 2004-08-02
14
366 Views
Last Modified: 2008-01-09
Hope someone could help me, I'm trying to download data via a CSV method, but for some reason the code I'm using will only allow up to 32500.  If I try anything over 32500 it will through the following error:

Microsoft VBScript runtime error '800a0006'
Overflow: 'NewCSV.NewCSV'



The following code is what i'm currently using:

<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/shds_pipe.asp" -->

<%
Set NewCSV =Server.CreateObject("Bigtime.CSV")

Set Conn  = Server.CreateObject("ADODB.Connection")
      Conn.Open "DSN="
      
Set RS = Server.CreateObject("ADODB.Recordset")
rs.ActiveConnection = MM_shds_pipe_STRING    
      sql = "SELECT * from world"
      
      RS.Open sql, Conn,3,3
      
   Call NewCSV.NewCSV("world_file","F:\pnetpub\shdsinventory.intra.bt.com\shdsprovision\csvdata\", RS,32500)

   RS.MoveFirst

   Call NewCSV.NewTab("world_file_txt","F:\pnetpub\shdsinventory.intra.bt.com\shdsprovision\csvdata\", RS,32500)

      RS.close
      Conn.close
      
Set RS = Nothing
Set Conn = Nothing

Set NewCSV = Nothing

response.Redirect("csv_download_world_file.asp")
%>
0
Comment
Question by:Ysd
  • 4
  • 3
  • 2
  • +3
14 Comments
 
LVL 16

Expert Comment

by:golfDoctor
ID: 11692712
Maybe in you initialization:

 Call NewCSV.NewCSV("world_file","F:\pnetpub\shdsinventory.intra.bt.com\shdsprovision\csvdata\", RS,32500)


Why do you have 32500 in that line?  Looks like it might be an upper boundary.
0
 
LVL 15

Expert Comment

by:joeposter649
ID: 11693993
Couple other things...
Using Conn in the rs.open will override the rs.ActiveConnection = MM_shds_pipe_STRING.
Do you want to do your movefirst before the first call to newcsv?  Maybe you should get rid of it all together and use the default of adOpenForwardOnly instead of adOpenStatic.
Which brings us to the last point...use vb constants in your rs.open call.
0
 

Author Comment

by:Ysd
ID: 11694349
golfdoctor,

I have tried what you said without the 32500 {Call NewCSV.NewCSV("world_file","F:\pnetpub\shdsinventory.intra.bt.com\shdsprovision\csvdata\")}, but the following error message appears:

Microsoft VBScript runtime error '800a01c1'
Argument not optional: 'NewCSV.NewCSV'


0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

Author Comment

by:Ysd
ID: 11694370
joeposter649,

I've just began working on this code, and I'm quite new to these functions, I dont understand what you mean when you say to use adOpenForwardOnly?

0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 11694451
Post here your functions: NewCSV,  evidently you have an Integer function such as CInt that needs to be replaced with the corresponding Long function CLng.
0
 

Author Comment

by:Ysd
ID: 11694470
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/shds_pipe.asp" -->

<%
Set NewCSV =Server.CreateObject("Bigtime.CSV")

Set Conn  = Server.CreateObject("ADODB.Connection")
     Conn.Open "DSN="
     
Set RS = Server.CreateObject("ADODB.Recordset")
rs.ActiveConnection = MM_shds_pipe_STRING    
     sql = "SELECT * from world"
     
     RS.Open sql, Conn,3,3
     
   Call NewCSV.NewCSV("world_file","F:\pnetpub\shdsinventory.intra.bt.com\shdsprovision\csvdata\", RS,32500)

   RS.MoveFirst

   Call NewCSV.NewTab("world_file_txt","F:\pnetpub\shdsinventory.intra.bt.com\shdsprovision\csvdata\", RS,32500)

     RS.close
     Conn.close
     
Set RS = Nothing
Set Conn = Nothing

Set NewCSV = Nothing

response.Redirect("csv_download_world_file.asp")
%>
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 11694516
Let's try that again.  You have a function called NewCSV in a dll called "Bigtime.CSV", please post the code, so that we can understand what is happening and offer a solution.
0
 
LVL 15

Expert Comment

by:joeposter649
ID: 11694772
This is a little off track but...

adOpenForwardOnly is a vb constant that is used to define the type of curserto use when you open a recordset.
http://devguru.com/Technologies/ado/quickref/recordset_open.html

These constants are defined using adovbs.inc or better yet a project reference...
http://authors.aspalliance.com/stevesmith/articles/no_adovbs.asp

Then your line
RS.Open sql, Conn,3,3
would be easier to understand...
RS.Open sql, Conn,adOpenStatic,adLockOptimistic

And I could say since you don't ever want to move backwards in your cursor your can use the more efficient adOpenForwardOnly for the cursor type.  And since you're just reading the record you could use adLockReadOnly for the lock type.
0
 
LVL 16

Expert Comment

by:golfDoctor
ID: 11698557
ysd - I didn't mean get rid of it, just meant to make it higher number...:

Call NewCSV.NewCSV("world_file","F:\pnetpub\shdsinventory.intra.bt.com\shdsprovision\csvdata\", RS,42500)
0
 

Author Comment

by:Ysd
ID: 11701536
golfDoctor,

I've tried what you suggested in the very first place, bust as I said above.  It will only allow upto 32500 record anything after that the following message will appear:

Microsoft VBScript runtime error '800a0006'
Overflow: 'NewCSV.NewCSV'


0
 
LVL 15

Accepted Solution

by:
joeposter649 earned 50 total points
ID: 11704686
The value is probably passed as an integer which has a max of 32767 (I think)  in vb.

To fix the problem you must understand that Server.CreateObject("Bigtime.CSV") creates an instance of an object that has been installed on your machine which is probably an inhouse vb program.  You should find the source code for that program and change the last parameter in the NewCSV() and NewTab() methods from an integer (int) to long (lng).  Compile the program and install on your webserver.
0
 
LVL 9

Assisted Solution

by:apirnia
apirnia earned 50 total points
ID: 11710484
Try something like this:



  Response.ContentType = "application/vnd.ms-excel"
       Response.AddHeader "content-disposition","attachment; filename=ALMReport.xls"

      Dim iloop,iloop2
      'Set table size and format
      Response.Write "<TABLE WIDTH=100% BORDER=1 CELLSPACING=1 CELLPADDING=1 align=center borderColor=d3d3d3>"

      'Print Table headings, field names from the query
      For iloop = 0 to RS.Fields.Count - 1
            Response.Write "<td bgcolor=ACCCF3><B><font size=2>" & RS.Fields(iloop).Name & "</font></B></TD>"
      Next
      Response.Write "</TR>"

      Do While not RS.EOF
            Response.Write "<TR>"

            'print coloumns
            For iloop = 0 to RS.Fields.Count - 1
                  Response.Write "<TD><font size=2 face=Arial>" & RS.Fields(iloop).Value & "</font></TD>"
            Next

            Response.Write "</TR>"
            RS.MoveNext

      Loop
            Response.Write "</Table>"

      RS.Close
      Set RS = Nothing
0
 
LVL 6

Expert Comment

by:masirof
ID: 12666793
No comment has been added to this question in more than 21 days, so it is now classified as abandoned..
I will leave the following recommendation for this question in the Cleanup topic area:
Split: joeposter649 & apirnia

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

masirof
EE Cleanup Volunteer
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question