【发布时间】:2015-12-14 19:45:02
【问题描述】:
我在 Access 数据库中有一堆是/否字段,我需要进入 SQL Server。如果我查看 Access 数据,这些字段包含 0 或 -1。在 SQL Server 端,我创建了对我不起作用的 BIT 类型的字段,我假设是因为 BIT 需要 0 或 1。这是我的错误:
The given value of type String from the data source cannot be converted to type bit of the specified target column. --->
System.FormatException: Failed to convert parameter value from a String to a Boolean.
String was not recognized as a valid Boolean
我也尝试过使用 nvarchar(3) 也不起作用,说“来自数据源的 String 类型的给定值无法转换为 nvarchar 类型”
我应该使用哪种数据类型?我尝试过 BIT、TINYINT、NVARCHAR(3)、CHAR(1) 和 CHAR(2)。
使用 CHAR(1) 或 CHAR(2) 会给我一个不同的错误:
System.Data.SqlClient.SqlException (0x80131904): Received an invalid column length from the bcp client for colid 13.
但无论哪种方式都不起作用
【问题讨论】:
标签: c# sql-server ms-access