Last post Jul 24, 2008 04:10 PM by Robert1980
Jul 24, 2008 12:18 PM|Robert1980|LINK
So I've got a big Access table that I need to run through to create a text file, one line for each row.
Now i'm getting an out of memory exception when filling the data table. I don't really NEED it all loaded in memory but i'm not having much luck with the OleDbDataReader.
What i would really like to be able to do is loop on each row in the results set from that select without loading the whole thing into a data table but i would be fine just killing the out of memory exception. (I'm garbage collecting right before and after
the code listed below)
I'm trying to duplicate the export to text functionality of Access but without using the access object. (Microsoft says that automating server processing using office controls is a bad idea)
Up to now i've just been doing this
Jul 24, 2008 03:04 PM|Mikesdotnetting|LINK
Dim query As String = "Select * From [" & table * "]"
Dim EConn As New OleDbConnection(connstr)
Dim MyCommand As New OleDbCommand(query,EConn)
Dim Rdr As New OleDbDataReader
Rdr = MyCommand.ExecuteReader()
'Process the results
Rdr = Nothing
Jul 24, 2008 04:10 PM|Robert1980|LINK
I've got that part pretty much figured out. It seems like once there you've got to get each column specifically with the correct data type or it fails. I want to just grab the row and loop through each column pulling it as text. I'll keep going down the
data reader road sense it looks like the right way to go.
Ya know i always try to make everything much more complicated than it needs to be. I didn't see that you could reference the reader with an index to get the column. So simple i saw right past it.
Thanks for your answer!