0

Using Asp.Net (C#) I'm submitting the following value to a field in the DB:

//Adding to parameters (for stored proc)
command.Parameters.Add( "MyField", SqlDbType.Bit, 1 ).Value = "1";

How do I fix this issue? What am I doing wrong?

2 Answers 2

2

According to MSDN, SqlDbType.Bit is:

An unsigned numeric value that can be 0, 1, or null.

So, try:

command.Parameters.Add( "MyField", SqlDbType.Bit, 1 ).Value = 1;
Sign up to request clarification or add additional context in comments.

Comments

-1

cmd.Parameters.Add("MyField", SqlDbType.Bit).Value = true;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.