convert nvarchar to bit C#

Asked

Viewed 77 times

-1

good night!

its new in C language#

would like to know how to convert nvarchar to bit

System.Data.Sqlclient.Sqlexception: 'Failed to convert nvarchar value 'Punctual Payment' to bit data type.'

strSQL.Parameters.AddWithValue("@parm22", checkbox_pg_pontual.Text);
  • Use: Boolean.Parse(checkbox_pg_pontual.Text).

  • 1

    tried by, only it is still appearing System.Formatexception: 'String was not recognized as valid Boolean.'

1 answer

2


The data column of the type BIT in Sqlserver is usually used to store variables of type bool or booleano as they are known, although they do not store True or False and yes 0, 1 or null usually.

When you pass "True" or "False" text using Sqlparams this conversion is done automatically.

So I don’t know which text is trying to convert in type column bit but make sure it is a value acceptable by the explicit type of the column.

  • i know, but this giving error still System.Formatexception: 'String was not recognized as valid Boolean.'

  • How is your string?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.