Reputation: 199
i am working on windows application.i am taking value from my sql database then writing to one .txt file.i have a code like this:
sql = "select * from " & strtablename
cmd = New SqlCeCommand(sql, CONN)
dr = cmd.ExecuteReader()
ListBox1.Items.Add("Extracting " & strfilename)
ListBox1.Refresh()
While (dr.Read())
sw = New StreamWriter(hht_Memory & "\Export\" & strfilename & ".txt", True)
prcount = 0
fvalues = ""
For I = 0 To dr.FieldCount - 1
If fvalues = "" Then
fvalues = IIf(IsDBNull(dr(I)), "", dr(I))
fvalues = Trim(Replace(fvalues, "'", ""))
Else
fvalues = fvalues & ", "
fvalues = fvalues & IIf(IsDBNull(dr(I)), "", dr(I))
fvalues = Trim(Replace(fvalues, "'", ""))
End If
Next I
sw.WriteLine(fvalues)
prcount = prcount + 1
sw.Close()
this is writing to text file.but each value separated by comma.i want to separate each value by |.
what the changes i have to make in my code?
Upvotes: 0
Views: 79
Reputation: 35400
This line:
fvalues = fvalues & ", "
should be changed to:
fvalues = fvalues & "| "
Upvotes: 1