Can someone please help.

I have a dataset that is populated with a csv or a tab seperated txt. I get the datset fine but when I try to insert into a table in sql with bulkinsert I am getting an exception.

The table does not allow nulls in the column. So what I need help with is scanning the dataset for a null value and replacing with an empty string or int value.

I spent some time looking around and found some code that will testif a column has a null value but I cannot seem to find the values and replace them.

Any help would be appreciated.

I will post some code a little later, just not on my work computer right now.

Thanks in advance

Recommended Answers

All 3 Replies

You can solve it using default on database side, if you insert null value it automatically replaced by a specified value.

I wish that were true because it has a default of an empty string.

Thanks tho. I am looking into this more and I cannot seem to find a way to scan the entire dataset for dbnulls.

Man I wish this were a oneoff, I would just edit the file...lol

Thanks again, hopefully I can get this worked out.

Edit the file:|!!!!!!! I don't like such solutions! Any way mark it as solved if you want to dicuss more about this problem reply...

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.