我有一个带有arround 30000记录的数据集,因此在其中进行loping并构建字符串fileStavki trows exeption,systemoutofmemmory。我怎么能解决这个问题。正在使用数组可能的解决方案或其他什么?
Dim sb As New StringBuilder
For Each inRow In ds_in.Tables(0).Rows
rbr += 1
pisi_red = "2" & Enc3.prefill(rbr, "0", 6) & Share.RightPrefill(inRow("prioritet"), "0", 5)
pisi_red &= Enc3.prefill(Enc3.IsNull(inRow("smetka_davac"), "0"), "0", 15)
pisi_red &= Share.RightPrefill(Enc3.lat2kir(Enc3.IsNull(inRow("naziv_davac"), "")), " ", 70)
pisi_red &= Share.RightPrefill(Enc3.IsNull(inRow("povik_broj_davac"), ""), " ", 24)
pisi_red &= Share.RightPrefill(Enc3.lat2kir(Enc3.IsNull(inRow("cel_na_doznaka"), "")), " ", 70)
pisi_red &= Enc3.prefill(inRow("sif_tip_plakanje"), "0", 6)
pisi_red &= "+" & Enc3.prefill(FormatNumber(inRow("iznos"), 5, TriState.False, TriState.False, TriState.False), "0", 21)
pisi_red &= inRow("smetka_primac") & Share.RightPrefill(Enc3.lat2kir(Trim(inRow("naziv_primac"))), " ", 70)
pisi_red &= Share.RightPrefill(Enc3.IsNull(inRow("povik_broj_primac"), ""), " ", 24)
pisi_red &= inRow("tip_instrument") & Share.RightPrefill(Enc3.IsNull(inRow("broj_transakcija"), ""), " ", 16)
pisi_red &= inRow("sistem_poravnuva") & Enc3.prefill(Enc3.IsNull(inRow("edb"), ""), "0", 13)
pisi_red &= vbCrLf
sb.Append(pisi_red)
'fileStavki &= pisi_red
Next
之后我有
sw.Write(fileStavki)
sw.Flush()
sw.Close()
我认为即使我使用stringbuilder,字符串fileStavki也会像这样构建
filestavki = sb.ToString
在这里,我也将得到永远的记忆