Solved

import issue in bit values

Posted on 2016-10-17
3
43 Views
Last Modified: 2016-10-19
i have a issue in importing bit values in to database using SqlBulkCopy
Creating object of datatable :

  tblcsv.Columns.Add("EmailOptOut");
                tblcsv.Columns.Add("IsConverted");

Mapping Table column :

           objbulk.ColumnMappings.Add("EmailOptOut", "EmailOptOut");
             objbulk.ColumnMappings.Add("IsConverted", "IsConverted");


these are the bit column in sql database.when i am trying import,it showing some error
like
 "The given value of type String from the data source cannot be converted to type money of the specified bit column"
0
Comment
Question by:karthik80c
3 Comments
 
LVL 45

Assisted Solution

by:Vitor Montalvão
Vitor Montalvão earned 250 total points
Comment Utility
Do you have null values? If so you'll need to test it first before converting.
0
 
LVL 20

Accepted Solution

by:
Russ Suter earned 250 total points
Comment Utility
What are the data types of the columns in your DataTable (the one named tblcsv)? They need to be of either type System.Boolean or System.Data.SqlTypes.Bit.
0
 

Author Closing Comment

by:karthik80c
Comment Utility
thank you for your suggestions.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now