473,796 Members | 2,625 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

generate CSV or comma delimited

What's the easiest way to generate CSV or a comma delimited file from an ASP
recordset? I've seen a few searching the internet and they appear to be
overkill or out of date.

thanks
Jul 19 '05 #1
4 16626
Did you see any that use GetString() ?


"shank" <sh***@tampabay .rr.com> wrote in message
news:um******** ******@TK2MSFTN GP10.phx.gbl...
What's the easiest way to generate CSV or a comma delimited file from an ASP recordset? I've seen a few searching the internet and they appear to be
overkill or out of date.

thanks

Jul 19 '05 #2
Something like:

Do while not rs.EOF
For each f in rs.fields
sOutput = sOutput & f.value & ","
Next
sOutput = sOutput & vbCrLf
Loop

Then write sOutput to a file using FSO. (If you're not sure about that,
post back.)

Not tested

Ray at work


"shank" <sh***@tampabay .rr.com> wrote in message
news:um******** ******@TK2MSFTN GP10.phx.gbl...
What's the easiest way to generate CSV or a comma delimited file from an ASP recordset? I've seen a few searching the internet and they appear to be
overkill or out of date.

thanks

Jul 19 '05 #3
Do you happen to have some code example?
Beginning to end...?
The following code appears to be working, but no results.
thanks

"Ray at <%=sLocation% >" <as*@me.forit > wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Something like:

Do while not rs.EOF
For each f in rs.fields
sOutput = sOutput & f.value & ","
Next
sOutput = sOutput & vbCrLf
Loop

Then write sOutput to a file using FSO. (If you're not sure about that,
post back.)

Not tested

Ray at work


"shank" <sh***@tampabay .rr.com> wrote in message
news:um******** ******@TK2MSFTN GP10.phx.gbl...
What's the easiest way to generate CSV or a comma delimited file from an

ASP
recordset? I've seen a few searching the internet and they appear to be
overkill or out of date.

thanks


Jul 19 '05 #4
Hello

Try this:

Set fs=Server.Creat eObject("Script ing.FileSystemO bject")
Set ctf = fs.CreateTextFi le(Server.MapPa th("test.csv") , 2)

If Not rset1.EOF Then
ctf.WriteLine(" ISP,Address") '*** If you want titles to your columns
for your csv file

While Not rset1.EOF
ctf.WriteLine(" """&(rset1.Fiel ds("ISP").Value )&""","""&(rset 1.Fields("Addre ss").Value)&""" ")
rset1.movenext
Wend
End if

ctf.Close
Set fs=nothing

'************** *************** *********
simple loops through your recordset writing out the fields on a line
with commas and creates new line per record, it will also put double
quote around all values, you will need to create a recordset, replace
my recordset tags with yours e.g. (rset1.Fields(" ISP").Value), you
will also need to change the titles e.g. ("ISP,Addres s") to the titles
you want for each column.

CSV File Format should look something like: (using my recordset
fields)

ISP,Address
"ISP Name1","ISP Address1"
"ISP Name2","ISP Address2"

etc.

Hope this helps, I have quickly simplified code hope I haven't made
any mistakes.

"shank" <sh***@tampabay .rr.com> wrote in message news:<Ou******* *******@TK2MSFT NGP12.phx.gbl>. ..
Do you happen to have some code example?
Beginning to end...?
The following code appears to be working, but no results.
thanks

"Ray at <%=sLocation% >" <as*@me.forit > wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Something like:

Do while not rs.EOF
For each f in rs.fields
sOutput = sOutput & f.value & ","
Next
sOutput = sOutput & vbCrLf
Loop

Then write sOutput to a file using FSO. (If you're not sure about that,
post back.)

Not tested

Ray at work


"shank" <sh***@tampabay .rr.com> wrote in message
news:um******** ******@TK2MSFTN GP10.phx.gbl...
What's the easiest way to generate CSV or a comma delimited file from an ASP recordset? I've seen a few searching the internet and they appear to be
overkill or out of date.

thanks


Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2825
by: Arne | last post by:
From: "Arne de Booij" <a_de_booij@hotmail.com> Subject: Comma delimited array into DB problems Date: 9. februar 2004 10:39 Hi, I have an asp page that takes input from a form on the previous page, puts that into an array and inserts the array into SQL server. Now here is the problem:
4
4873
by: Christine Forber | last post by:
I wonder if anyone knows of some javascript code to check a comma-delimited list of email addresses for basic formating. What I'm looking for is the javascript code to check a form field on form submission. If there is an entry in the field, does it match the following: text@text.text, text@text.text,text@text.text where each address is between commas and each address is in the format
3
5435
by: Elmo Watson | last post by:
I've been asked to develop a semi-automated type situation where we have a database table (sql server) and periodically, there will be a comma delimited file from which we need to import the data, replacing the old. I naurally know that we can use to kill the other data, but does anyone have any examples of importing a comma delimited file into SQL Server with ASP?
1
6694
by: John B. Lorenz | last post by:
I'm attempting to write an input routine that reads from a comma delimited file. I need to read in one record at a time, assign each field to a field array and then continue with my normal processing. I am having no luck at all finding different routines written in C to read delimited files of any kind. I have a few ideas of how I might go about this but I bet I'm re-inventing the wheel and there already exists some efficient code out...
9
4515
by: Wayne | last post by:
I have the following string: "smith", "Joe", "West Palm Beach, Fl." I need to split this string based on the commas, but as you see the city state contains a comma. String.split will spilt the city state. Is there a built in function that I'm missing that will do the split and recognize that the comma in city state is part of the item? --
9
3640
by: Bernie Yaeger | last post by:
Is there a way to convert or copy a .xml file to a comma delimited text file using vb .net? Thanks for any help. Bernie Yaeger
4
4811
by: JustSomeGuy | last post by:
Hi. I have a comma delimited text file that I want to parse. I was going to use fscanf from the C library but as my app is written in C++ I thought I'd use the std io stream library... My Text file looks like: First_Name, Last_Name, ID, Date/Of/Birth<newline> depending on the host the newline is either \n or \r\n
5
30302
by: no_spam_for_gman | last post by:
I have been using the export command for quite some times to export comma delimited file. I have always been looking at how to generate the first row with the column header but never found a clean way to do it. I have searched this newsgroup and the only suggestion found was to cast all column to strings and do a union, or to add the first row afterwards and I saw one suggestion where it was to create a unix script. Does anybody knows...
2
2135
by: Ron | last post by:
so if my textbox is named textbox1 and my listbox is named ltsdisplay, for the button that would make this all happen I would just need to: lstdisplay.items.textbox1(delimited.Split(",".ToCharArray())) is that right? or no? I try this and I get an error...
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10461
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10239
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10019
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9057
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7555
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6796
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4122
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.