Solved

CSV Download data

Posted on 2004-08-02
14
365 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

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…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

831 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