Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 7th, 2006, 11:11 AM
Authorized User
 
Join Date: Sep 2003
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
Default Outputing ASP data in a specific format

G'day,

My asp code for normal HTML output is derived from this sort of thing
<% Do While Not rstSearch.EOF %>
    <%= rstSearch.Fields (1) %>
    <%= rstSearch.Fields (2) %>
    <%= rstSearch.Fields (3) %>
    <%= rstSearch.Fields (4) %>
  <%
    iRecordsShown = iRecordsShown + 1
rstSearch.MoveNext
Loop
'done - close table

I need to format the results of my asp query to pass it to a java applet

So I want process the output in a format called TABLE_CONTENT
with one record per line which looks like this


var TABLE_CONTENT = [
["dayz1", "ADAMS", 88, 23746],
["rhit1s", "ADAMS", 74, 293772],
["kokain", "AGEEV", 67, 348304],
["agauth", "AGEEV", 48, 0],
];


Main probs I have are quotes around the str data and the ] before the last comma in each record

ANY errors and the whole thing just does not work

any help with code snippet would be most helpful

Thanks

Topshed
 
Old January 19th, 2006, 01:32 AM
Friend of Wrox
 
Join Date: May 2004
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

Please check the following code snippet

s1 = "dayz1"
s2 = "ADAMS"
s3 = 88
s4 = 23746
s5 = "[""" & s1 & """, """ & s2 & """, " & s3 & ", " & s4 & "],"

In the end you can remove the last comma using:
s6 = left(s5,len(s5)-1)

Hope this helps

Om Prakash
 
Old January 29th, 2006, 05:50 PM
Authorized User
 
Join Date: Sep 2003
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you,

That helped tremendously

Topshed





Similar Threads
Thread Thread Starter Forum Replies Last Post
Search specific data from specific columns yogeshyl SQL Language 1 January 16th, 2008 11:12 AM
Convert Rich Text Format to Ordinary Format in ASP Andraw Classic ASP Basics 1 August 31st, 2007 10:05 AM
Copy specific data in specific cells of sheet2 yogeshyl Excel VBA 1 May 14th, 2007 07:40 AM
Copy specific data from one sheet to another yogeshyl Excel VBA 2 May 11th, 2007 09:14 AM
Outputing Null values. Neal XSLT 2 July 25th, 2006 05:46 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.