Hello guys and gals.
As always any help is much appreciated.
I am at a dilema. I am filling a datagridview with very lengthy results. Roughly 60k rows on average. I am filling them via an oracle database using a table adapter. The records then have a filter placed on them in the datagridview so the results displayed are a bit different.
My problem: I built an export to excel function which populated a dataset and then red through it and wrote to excel. Bad idea with the amount of records I am using. I tried just writing the records straight to a csv file using streamwriter but I don't very much like this way.
My proposal: I would like to fill an array from the datagridview and then be able to dump the array into excel.However I am having some trouble finding examples on creating an array from a datagridview.
If anyone has encountered this problem or can suggest examples I would very much appreciate it.

Thanks

Recommended Answers

All 5 Replies

You should have a look into the third-party component GemBox.SpreadSheet.
I'm using it myself, and it's very very fast.

Thanks I will look into this. Any other suggestions?

Yeah. Only one, though you may have tried it already.
You can treat the excel file as a database, and use OleDb and OleDbDataAdapter to push the data into it.

Yeah.. I tried that and it was super quick. Think it's a good option. Guess I will have to work out a way to make excel sessions because the user needs to be able to have multiple exports open at once. Thanks for all your suggestions, Oxiegen. :)

No problem. :)
If you find my help useful, then please mark this thread as solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.