Improve company productivity with a Business Account.Sign Up

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

Tabular Data Control

Hi,

I am planning to use Tabular Data Control to read the CSV file.  It works fine when it reads from a plain txt file.  But I want to make CSV generate dynamiclly.  But it does not work.  Any ideas?  Many thanks.
0
mcrmg
Asked:
mcrmg
  • 9
  • 8
2 Solutions
 
Lord_McFlyCommented:
Hi, you say you want to read the CSV - then you say you want to generate it - which way around is it?

Please could you paste the code you are referring to - cheers.
0
 
mcrmgAuthor Commented:
<OBJECT ID="objTDC" CLASSID="clsid:333C7BC4-460F-11D0-BC04-0080C7055A83">
<PARAM NAME="DataURL" VALUE="TheList.asp">
<PARAM NAME="UseHeader" VALUE="True">
</OBJECT>

in The List.asp, I loop trough the RS to create CSV, I do not know if it is possible to do that.  Thanks
0
 
Lord_McFlyCommented:
Bear with me on this, now I don't know anything about Tabular Data Controls - but I do know and I do it ofter - about producing CSV files, so...

Are you able to read information from the control, if so can you include a bit of code which say for example will read the first row of data.
0
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.

 
mcrmgAuthor Commented:
The following is the code that I use to generate a CSV file, if I add this:

Response.ContentType = "application/csv"

       
Response.AddHeader "Content-disposition", "attachment; filename=myCSV.csv"



I will have a CSV file, and I have no problem to read a CSV file using that Tabular Data Controls, but since I have a real time web application, I do not know if it is possible to generate a csv on the fly for this control to use.


while not rs.eof
      Response.Write "C1"
      Response.Write ","
      Response.Write "C2"
      Response.Write ","
      Response.Write "C3"
                Response.Write vbNewLine

      Response.Write oRs("F1")
      Response.Write ","
      Response.Write oRs("F2")
      Response.Write ","
      Response.Write oRs("F3")
                Response.Write vbNewLine
      rs.movenext
wend
0
 
Lord_McFlyCommented:
Okay, well I take it you are able to read data from the control and to read a CSV file so I guess you just need to do the creating - as follows...

sFilename = "TheFile.csv"
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile(Path & sFilename,True)

objFile.WriteLIne "C1,C2,C2"
Do while nor rs.EOF
   objFile.WriteLine oRs("F1") & "," & oRs("F2")  & "," & oRs("F3")

   rs.MoveNext
Loop

objFile.Close
Set objFile = Nothing
Set objFSO = Nothing

...one CSV file :)
0
 
mcrmgAuthor Commented:
If there are more than one user on the site, and they all want to generate that report, and CSV, too.  Will it have a probelm?  Thanks
0
 
Lord_McFlyCommented:
If thats a possible concern then do the following....

sFileName = "File_" & Mid(Date(),1,2) & Replace(Time(),":","") & ".csv"

Basically thats taking the Day and the Time so you'd get

File_19144236.csv

If you take this route then you'll need to clear the old files from the server from time to time - but thats no biggy.
0
 
mcrmgAuthor Commented:
Thanks

Do you think it would be faster or displaying the report in ASP directly?  Thanks
0
 
Lord_McFlyCommented:
I'm not sure what you mean.
0
 
mcrmgAuthor Commented:
:)

Currently, I am display RS from DB directly in ASP.

While not rs.eof
......
wend


Which way do you think it will be faster in terms of speed of displaying the rs? Thanks
0
 
Lord_McFlyCommented:
So what is it that you would like to do...

• Display the info to the screen
• Save info to file

You talking about the speed of display - what are you comparing it to?

I'n not sure what you mean.

0
 
mcrmgAuthor Commented:
because I use paging in asp, say, I have a rs that contains 1000 records, but I only display it 10 at a time, I was thinking to use this control.  Maybe I was wrong.

The goal that I want to achive is that I want to see if there is a way to :
1. maybe get 10 records from db at a time
2. or, get 1000 back, but do the paging on the client side.
0
 
Lord_McFlyCommented:
There are MIN / MAX syntax that you can include in your queries but I'm having troble find documentation - I'm not sure how to use it off hand but it basically allows you to specify a range (page) so to speak.
0
 
mcrmgAuthor Commented:
is it the syntax in asp or SQL? because I am using Access now.
0
 
Lord_McFlyCommented:
Access uses SQL (SQLis just a langage) and MIN / MAX SQLsyntax - I had a search on the web but couldn't really find anything useful.

When you get your recordset do you apply any filtering (WHERE clause) or do you have a search for so you can create filtering.

Maybe you should limited you search results to say a 100 record by using the SELECT TOP 100 * FROM clause.
0
 
Lord_McFlyCommented:
Do you need any more assistance on this question?
0
 
mcrmgAuthor Commented:
Thank you
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

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.

  • 9
  • 8
Tackle projects and never again get stuck behind a technical roadblock.
Join Now