I have a problem with a carriage return at the beginning of each row of data being exported as a .csv file. My code:
<% Response.Buffer="true" %>
<!--#include file="../Connections/ConnWilbanks.asp" -->
<%
Dim rsDistList
Dim rsDistList_numRows
Set rsDistList = Server.CreateObject("ADODB.Recordset"
rsDistList.ActiveConnection = MM_ConnWilbanks_STRING
rsDistList.Source = "SELECT FirstName, LastName FROM tblMembers"
rsDistList.CursorType = 0
rsDistList.CursorLocation = 2
rsDistList.LockType = 1
rsDistList.Open()
rsDistList_numRows = 0
%>
<%
Response.Clear()
Response.AddHeader "Content-Disposition","inline; filename=list.csv"
Response.ContentType = "text/csv"
%>
<%
If Not rsDistList.EOF Then
%>
"<%=rsDistList.Fields.Item("FirstName".Name%>","<%=rsDistList.Fields.Item("LastName".Name%>"
<%
Do Until rsDistList.EOF
%>
"<%=rsDistList.Fields.Item("FirstName".Value%>","<%=rsDistList.Fields.Item("LastName".Value%<%=vbCRLF%>
<%
rsDistList.MoveNext
Loop
End If
%>
<%
Response.Flush()
Response.End()
%>
<%
rsDistList.Close()
Set rsDistList = Nothing
%>
The output looks like this:
<row1> [empty]
<row2> [John][Doe]
<row3> [empty]
<row4> [Jane][Doe]
<row5> [empty]
and so on...
Any ideas?
<% Response.Buffer="true" %>
<!--#include file="../Connections/ConnWilbanks.asp" -->
<%
Dim rsDistList
Dim rsDistList_numRows
Set rsDistList = Server.CreateObject("ADODB.Recordset"
rsDistList.ActiveConnection = MM_ConnWilbanks_STRING
rsDistList.Source = "SELECT FirstName, LastName FROM tblMembers"
rsDistList.CursorType = 0
rsDistList.CursorLocation = 2
rsDistList.LockType = 1
rsDistList.Open()
rsDistList_numRows = 0
%>
<%
Response.Clear()
Response.AddHeader "Content-Disposition","inline; filename=list.csv"
Response.ContentType = "text/csv"
%>
<%
If Not rsDistList.EOF Then
%>
"<%=rsDistList.Fields.Item("FirstName".Name%>","<%=rsDistList.Fields.Item("LastName".Name%>"
<%
Do Until rsDistList.EOF
%>
"<%=rsDistList.Fields.Item("FirstName".Value%>","<%=rsDistList.Fields.Item("LastName".Value%<%=vbCRLF%>
<%
rsDistList.MoveNext
Loop
End If
%>
<%
Response.Flush()
Response.End()
%>
<%
rsDistList.Close()
Set rsDistList = Nothing
%>
The output looks like this:
<row1> [empty]
<row2> [John][Doe]
<row3> [empty]
<row4> [Jane][Doe]
<row5> [empty]
and so on...
Any ideas?