473,395 Members | 1,496 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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 16598
Did you see any that use GetString() ?


"shank" <sh***@tampabay.rr.com> wrote in message
news:um**************@TK2MSFTNGP10.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**************@TK2MSFTNGP10.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****************@TK2MSFTNGP10.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**************@TK2MSFTNGP10.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.CreateObject("Scripting.FileSystemObject ")
Set ctf = fs.CreateTextFile(Server.MapPath("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.Fields("ISP").Value)&""" ,"""&(rset1.Fields("Address").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,Address") 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**************@TK2MSFTNGP12.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****************@TK2MSFTNGP10.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**************@TK2MSFTNGP10.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
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...
4
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...
3
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,...
1
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...
9
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...
9
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
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...
5
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...
2
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: ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...

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.