Using SqlBulkCopy Error: 1 DataSet does not support system.nullable<>,2. The given value of String type from the data source cannot be converted to the type nvarchar of the specified destination column.

Source: Internet
Author: User

First question,

Workaround: Dt.addcolunms ("Name", "type"), type cannot be typeof (int?), typeof (DateTime?) A nullable value type. The string can be. So the nullable value type is changed to not be empty.

Second question,

WORKAROUND: Bulkcopy.writetoserver (DT), first check the DT column type is not wrong?, if no problem, then check the order of the DT columns and database columns in the same order.

I met these two problems to solve the problem. Some friends might say, my DataTable column name is not a field name, why order consistent? In fact, he is in order, not according to the column name.

If there are errors, please note.

Using SqlBulkCopy Error: 1 DataSet does not support system.nullable<>,2. The given value of String type from the data source cannot be converted to the type nvarchar of the specified destination column.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.