Solved

import issue in bit values

Posted on 2016-10-17
3
47 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 46

Assisted Solution

by:Vitor Montalvão
Vitor Montalvão earned 250 total points
ID: 41846779
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
ID: 41846839
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
ID: 41851423
thank you for your suggestions.
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

862 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

25 Experts available now in Live!

Get 1:1 Help Now