LIMITE DATATABLE
Tenho um processo que faz a leitura de um .txt e grava em um datatable que por sua vez em entregue a um bulkinsert.
Os arquivos tem aproximadamente 3milhoes de registros, porém sugiu um maior(5mi) e dando exception outofmemory no datable.add(row).
Existe algum limite no datatable? alguém sabe como contornar?
Obrigado!
Já pensou em usar um List<T>?
Abraços!
Citação::
Se eu fosse você, eu leria registro a registro com um DataReader e iria gravando linha a linha no .txt com um StreamWriter...
Abraços!
Acho que o processo dele é ao contrário, lê do txt para gravar no banco depois
Citação:To add rows to a DataTable, you must first use the NewRow method to return a new DataRow object. The NewRow method returns a row with the schema of the DataTable, as it is defined by the table[ô]s DataColumnCollection. The maximum number of rows that a DataTable can store is 16,777,216. For more information, see Adding Data to a DataTable.
De acordo com o que está na documentação, o limite é de 16,777,216 rows.
Citação::
msdn.microsoft.com/en-us/library/system.data.datatable.aspx
To add rows to a DataTable, you must first use the NewRow method to return a new DataRow object. The NewRow method returns a row with the schema of the DataTable, as it is defined by the table[ô]s DataColumnCollection. The maximum number of rows that a DataTable can store is 16,777,216. For more information, see Adding Data to a DataTable.
De acordo com o que está na documentação, o limite é de 16,777,216 rows.
Isso, se não acabar o espaço de memória antes.
Obrigado pelo retorno,
No caso, ainda temos problemas de memória?
A memória virtual não contornaria este problema?
Abs
Consegui contornar gerando lotes de bulkinsert,
assim que o lote é gravado, limpo o datatable.clear() a memória é liberada e começo alimentar o datatable novamente.
tudo isso encapsulado em uma transação.
Atendeu minha necessidade.