Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

import issue in bit values

Posted on 2016-10-17
3
Medium Priority
?
72 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 52

Assisted Solution

by:Vitor Montalvão
Vitor Montalvão earned 1000 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 1000 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

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

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

In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Ready to get certified? Check out some courses that help you prepare for third-party exams.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

721 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