Solved

Tabular Data Control

Posted on 2004-04-17
17
498 Views
Last Modified: 2008-03-10
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
Comment
Question by:mcrmg
  • 9
  • 8
17 Comments
 
LVL 6

Expert Comment

by:Lord_McFly
ID: 10858240
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
 

Author Comment

by:mcrmg
ID: 10858920
<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
 
LVL 6

Expert Comment

by:Lord_McFly
ID: 10858986
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:mcrmg
ID: 10859129
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
 
LVL 6

Expert Comment

by:Lord_McFly
ID: 10859328
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
 

Author Comment

by:mcrmg
ID: 10859401
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
 
LVL 6

Expert Comment

by:Lord_McFly
ID: 10859497
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
 

Author Comment

by:mcrmg
ID: 10867423
Thanks

Do you think it would be faster or displaying the report in ASP directly?  Thanks
0
 
LVL 6

Expert Comment

by:Lord_McFly
ID: 10867516
I'm not sure what you mean.
0
 

Author Comment

by:mcrmg
ID: 10867529
:)

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
 
LVL 6

Expert Comment

by:Lord_McFly
ID: 10867599
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
 

Author Comment

by:mcrmg
ID: 10867629
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
 
LVL 6

Assisted Solution

by:Lord_McFly
Lord_McFly earned 300 total points
ID: 10867714
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
 

Author Comment

by:mcrmg
ID: 10867730
is it the syntax in asp or SQL? because I am using Access now.
0
 
LVL 6

Accepted Solution

by:
Lord_McFly earned 300 total points
ID: 10867921
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
 
LVL 6

Expert Comment

by:Lord_McFly
ID: 10885429
Do you need any more assistance on this question?
0
 

Author Comment

by:mcrmg
ID: 10928976
Thank you
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
asp syntax 3 66
Html Table Looping (part 2) 5 34
Time comparison asp 1 20
ASP Classic - Read XML File inner content 10 42
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…
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 …
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

685 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