1

I tried to set the parameter value to system.dbnull.value but got some errors. thanks.

2
  • Operand type clash: nvarchar is incompatible with image... Commented Jun 15, 2009 at 21:29
  • Show us the code where you set the parameters, and the sql, please. Commented Jun 15, 2009 at 23:04

2 Answers 2

2

What is happening is that SQLServer is reading the NULL type as nvarchar, which cannot be used to update an Image column.

Try specifying the Parameter Type as SqlDbType.Image

SqlParameter myParam = new SqlParameter("@NameOfParameter",SqlDbType.Image);
Sign up to request clarification or add additional context in comments.

Comments

0

An alternative is to not use a parameter when you're setting it to null. Instead, you can hardcode '=null' in the SQL command and skip parameters completely.

1 Comment

This works, but he might be coding this into his datalayer and wants to be able t o set the correct parameter value.

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.