views:

17

answers:

1

I am using my custom CSVDataReader : IDataReader {} to insert Bulk values in a Database table.

Every datatype but the Bit (from "1"/"0") is parsed perfectly. I am getting the following error " value of type String from the data source cannot be converted to type bit" while parsing 0 or 1 as bool

If I change these values to "true"/"false". It is taken without any problem.

I can't alter the CSV file. Currently I replace that specific column from "0"/"1" to "false"/"True" during Iteration. But this is not an elegant solution.

Please help !

Thanks Panks

A: 

I guess you're sending "1" and "0" rather then 1 and 0

FYI, SQL Server will accept true and false for bit

gbn
The CSVDataReader reads the file using a StreamReader, It reads line by line and parse each line as string. So all the column values are string. this.stream = new StreamReader(fileName); in Read() method I split the line string[] currentRow = stream.ReadLine().Split(',');
Panks
SQL won't parse "true" or "false"with quotes so *something* is different
gbn