Operand type clash: nvarchar is incompatible with image


D

Diego

I'm using a msSqlServer 2000 stored procedure to create a new record with
this syntax: :

cmd.Parameters.Add("@photo", DBNull.Value);
cmd.ExecuteNonQuery();

but the result is a:
Operand type clash: nvarchar is incompatible with image
Photo is not the only parameter but is the only image one, I am not passing
a nvarchar but a null value, am I missing something?
Diego.
 
Ad

Advertisements

M

Marina

If you don't seta data type on the parameter, it will default to varchar.
You need to explicitly set it to image.
 
V

Val Mazur \(MVP\)

Hi Diego,

Always specify datatype of the parameters explicitly. Otherwise it could
lead to the fact that your are passing invalid datatypes. By-default your
parameter will be declared as varchar and in your case it will not work.
 
B

bart

Hi,

Could you help me how I can specify the datatype of the parameters
explicitly?
I have the same problem as Diego....

I have a column named "Picture" and as Column Type "Image", but when I would
like to update or insert an image into my DB I receive the same error as
Diego...

I'm using ASP.NET2.0 and using DetailsView with an EditTemplate.

Can you help me with this ?

Thanks,
Bart
 
Ad

Advertisements

L

Lale Divringi [MSFT]

You need to specify the data type of the SqlParameter using the SqlType
property. If you don't specify the data type of the parameter, it defaults
to 'nvarchar' which is most likely what you are seeing.

Thanx
Lale Divringi

DISCLAIMER: This posting is provided "AS IS" with no warranties, and confers
no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top