错误信息:无法将参数值转换字符串到布尔布尔、错误信息、字符串、参数

2023-09-07 10:17:39 作者:满城阳光不及她

我正在一个错误味精试图更新从asp.net记录到SQL数据库时。唯一布尔值被更新为:

I am getting an error msg when attempting to update a record from asp.net into a SQL database. The only boolean value being updated is:

cmdAddUser.Parameters.Add(new SqlParameter("@Active", SqlDbType.Bit));
cmdAddUser.Parameters["@Active"].Value = 
    Convert.ToBoolean(cbAddUserActiveUser.Checked);

在数据库中的数据类型@Active是位。任何想法?

The datatype for @Active in the database is "bit". Any ideas?

推荐答案

远投 - 你有被设置为一个字符串,但在实际的表位列另一个参数

Long shot - have you got another parameter that is set as a string but is a bit column in the actual table?