Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 372
  • Last Modified:

CSV Download data

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
Ysd
Asked:
Ysd
  • 4
  • 3
  • 2
  • +3
2 Solutions
 
golfDoctorCommented:
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
 
joeposter649Commented:
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
 
YsdAuthor Commented:
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
YsdAuthor Commented:
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
 
Anthony PerkinsCommented:
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
 
YsdAuthor Commented:
<%@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
 
Anthony PerkinsCommented:
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
 
joeposter649Commented:
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
 
golfDoctorCommented:
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
 
YsdAuthor Commented:
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
 
joeposter649Commented:
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
 
apirniaCommented:
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
 
masirofCommented:
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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

  • 4
  • 3
  • 2
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now