I am using the below code to create a csv file and It works fine but the apps that i am working on right now has three different girdviews and I would like to create one csv files for the three of them togher.My question is can i this code to create that....and if it is possible can someone give me a clue how i can accomplish this. thanks
......
drc = CSVLetting.ExecuteReader()
sb = New System.Text.StringBuilder
'for field name
For i = 0 To drc.FieldCount - 1
If i < (drc.FieldCount - 1) Then
sb.Append(Chr(34) & drc.GetName(i) & Chr(34) & ",")
Else
sb.Append(Chr(34) & drc.GetName(i) & Chr(34) & vbCrLf)
End If
Next
'for field value
While drc.Read()
For i = 0 To drc.FieldCount - 1
If i < (drc.FieldCount - 1) Then
sb.Append(Chr(34) & drc.GetValue(i).ToString.Replace(Chr(34), Chr(34) & Chr(34)) & Chr(34) & ",")
Else
sb.Append(Chr(34) & drc.GetValue(i).ToString & Chr(34) & vbCrLf)
End If
Next
End While
drc.Close()
Response.ContentType = "Application/x-csv"
Response.AddHeader("content-disposition", "attachment;filename=""" & filename & """")
Response.Write(sb.ToString)
Response.End()
......
drc = CSVLetting.ExecuteReader()
sb = New System.Text.StringBuilder
'for field name
For i = 0 To drc.FieldCount - 1
If i < (drc.FieldCount - 1) Then
sb.Append(Chr(34) & drc.GetName(i) & Chr(34) & ",")
Else
sb.Append(Chr(34) & drc.GetName(i) & Chr(34) & vbCrLf)
End If
Next
'for field value
While drc.Read()
For i = 0 To drc.FieldCount - 1
If i < (drc.FieldCount - 1) Then
sb.Append(Chr(34) & drc.GetValue(i).ToString.Replace(Chr(34), Chr(34) & Chr(34)) & Chr(34) & ",")
Else
sb.Append(Chr(34) & drc.GetValue(i).ToString & Chr(34) & vbCrLf)
End If
Next
End While
drc.Close()
Response.ContentType = "Application/x-csv"
Response.AddHeader("content-disposition", "attachment;filename=""" & filename & """")
Response.Write(sb.ToString)
Response.End()