我創建從數據reader.my代碼csv文件來的所有值是這樣的:而生成CSV在1分第一列
While (dr.Read())
sw = New StreamWriter(hht_Storage & "\Export\" & strfilename & ".csv", 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 & vbTab
fvalues = fvalues & IIf(IsDBNull(dr(I)), "", dr(I))
fvalues = Trim(Replace(fvalues, "'", ""))
End If
Next I
sw.WriteLine(fvalues)
prcount = prcount + 1
sw.Close()
End While
但在我CSV.i的第一列即將所有值要顯示每個csv列中的每個值。
任何幫助是非常可觀的。
我認爲,這將是一個更好的方式來增加你的領域限制就在'下一步I'前面。如果你想獲得更好的性能,那麼使用StringBuilder而不是fvalues。 – muffi
@ muffi,在這種情況下,我可以重新寫我的代碼。 – user3262364
使用stringbuilder是可選的。無論如何,它也可以使用字符串。但是你的限制器是什麼?我認爲,它是'vbTab',對吧?在這種情況下,將此行向下移動到'Next'前面:'fvalues = fvalues&vbTab' – muffi