创建SqlCe表时出错:指定的数据类型无效。 [数据类型(如果已知)=位] [英] Error while creating SqlCe table: The specified data type is not valid. [ Data type (if known) = bit ]

查看:358
本文介绍了创建SqlCe表时出错:指定的数据类型无效。 [数据类型(如果已知)=位]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





尝试在C#.NET 4.0项目中的SQL Server Compact Edition数据库中创建表时出现以下错误: br />


指定的数据类型无效。 [数据类型(如果已知)=位]



这是相关的子字符串(SqlCeCommand字符串的一部分):



[OnlineOffline]位(1),



字符串的各个部分还有其他类型,例如NVarChar和DateTime,没有这些问题。



有什么想法吗?

解决方案

Bit数据类型不支持LENGTH参数,所以只需删除(1):

 创建  myTable(myBit 位<​​/ span>,myStr  NVARCHAR  100 ))


Hi,

I'm getting the following error while trying to create a table in an SQL Server Compact Edition database in a C# .NET 4.0 project:

The specified data type is not valid. [ Data type (if known) = bit ]

This is the relevant substring (part of the SqlCeCommand string):

[OnlineOffline] Bit (1),

There are other types in various parts of the string, such as NVarChar and DateTime, and there is no problem with those.

Any ideas?

解决方案

The Bit datatype doesn't support a LENGTH parameter, so just remove the (1):

CREATE TABLE myTable (myBit bit, myStr NVARCHAR(100))


这篇关于创建SqlCe表时出错:指定的数据类型无效。 [数据类型(如果已知)=位]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆