Solved

CSV Download data

Posted on 2004-08-02
14
360 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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
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/…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

757 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

21 Experts available now in Live!

Get 1:1 Help Now