J
Joey Martin
I am using a SQL 2000 server and am trying to export results from a
query to a text file. The code is working, expect my CONTACTNAME field
has a comma, and my export is splitting that into 2 columns when I only
want it to be one.
Here is my code:
set conn = CreateObject("ADODB.Connection")
conn.open DSNtemp
set rs = conn.execute("select
contactname,contactnumber,contactnumber1,contactemail,address,city,state
,zip,type,sqft,0,bedrooms,baths,lotsize,acreage,garage,comments,price,0,
0,CASE MAINPHOTO WHEN 0 THEN 0 ELSE 1 END [MAINPHOTO],county from
propertydata where active='Y'")
csvText = rs.getString(2,,",",VBCrLf)
rs.close: set rs = nothing
conn.close: set conn = nothing
set fso = CreateObject("Scripting.FileSystemObject")
set fs = fso.CreateTextFile(Server.MapPath("csv.csv"), true)
fs.writeline(csvText)
fs.close: set fs = nothing
set fso = nothing
Again, this works, but it splits CONTACTNAME into 2 columns. The same
probably in the DESCRIPTION field. How do get it to IGNORE the columns
in those fields?
Thanks!
query to a text file. The code is working, expect my CONTACTNAME field
has a comma, and my export is splitting that into 2 columns when I only
want it to be one.
Here is my code:
set conn = CreateObject("ADODB.Connection")
conn.open DSNtemp
set rs = conn.execute("select
contactname,contactnumber,contactnumber1,contactemail,address,city,state
,zip,type,sqft,0,bedrooms,baths,lotsize,acreage,garage,comments,price,0,
0,CASE MAINPHOTO WHEN 0 THEN 0 ELSE 1 END [MAINPHOTO],county from
propertydata where active='Y'")
csvText = rs.getString(2,,",",VBCrLf)
rs.close: set rs = nothing
conn.close: set conn = nothing
set fso = CreateObject("Scripting.FileSystemObject")
set fs = fso.CreateTextFile(Server.MapPath("csv.csv"), true)
fs.writeline(csvText)
fs.close: set fs = nothing
set fso = nothing
Again, this works, but it splits CONTACTNAME into 2 columns. The same
probably in the DESCRIPTION field. How do get it to IGNORE the columns
in those fields?
Thanks!