I am trying to generate a small txt file for each record in a table but I am getting out of memory errors.
This is all incredibly me so any help greatly appreciated and keep it simple please.
I am obviously doing something wrong as the app grinds to a halt after appx 290 records- any suggestions?
This is all incredibly me so any help greatly appreciated and keep it simple please.
Code:
osql = "SELECT * FROM propertylist where fap<>0 order by thePrice desc"
oda = New OleDb.OleDbDataAdapter(osql, con)
oda.Fill(ds, "office")
oda.FillSchema(ds, SchemaType.Source, "office")
offmatchmax = ds.Tables("office").Rows.Count
For countoffice = 0 To offmatchmax - 1
Dim ob As New OleDb.OleDbCommandBuilder(pda)
Form1.narrativeText.Visible = False
Dim FILE_NAME As String = "c:\Fap\p1" & Trim(ds.Tables("office").Rows(countoffice).Item("theref")) & ".txt"
Dim objWriter As New System.IO.StreamWriter(FILE_NAME)
Dim fulltxt As String
fulltxt = "<i>" & Trim(ds.Tables("office").Rows(countoffice).Item("asciiFull")) & "</i>"
objWriter.WriteLine("<Font face=" & """" & "Times New Roman" & """" & ">" & Trim(ds.Tables("office").Rows(countoffice).Item("thename")) & "<p>" & Trim(fulltxt) & "<p>We are currently updating our listings so please contact us for full details<p>view this and other properties in a range of destinations at [URL unfurl="true"]www.suncastle.co.uk<p>Follow[/URL] us on twitter @suncastlePlus" & "</font>")
objWriter.Close()