Solved

CSV Download data

Posted on 2004-08-02
14
361 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
 

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Translate a cURL request to Classic ASP 4 405
iis reverse proxy virtual directory 8 130
Highlight a word from some text 16 48
Question about ASP Including Files 6 38
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
I designed this idea while studying technology in the classroom.  This is a semester long project.  Students are asked to take photographs on a specific topic which they find meaningful, it can be a place or situation such as travel or homelessness.…
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.

948 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now