SqlBulkCopy with Excel and NULL values RRS feed

  • Question

  • I have a spreadsheet that has a defined number of rows. But when I use Oldb to read the spreadsheet the reader seems to think that there are more rows than there really are. So when I turn this whole process over to SqlBulkCopy I get an exception indicating that I cannot have DBNull. How can I restrict the rows that are valid data on the spreadsheet? If I create a totally new spreadsheet the extra rows are not created and it only reads in the 'valid' data and the builk copy works. So how can I define a region in an Excel spreadsheet so that there are only a defined number of rows?

    Thank you.


    Monday, September 13, 2010 9:46 PM