Conversion failed when converting the nvarchar value 'quiz.jpg' to data type int
I am getting this error in my logs and I really do not know how to solve it.
"Conversion failed when converting the nvarchar value 'quiz.jpg' to data type int."
I am currently using ColdFusion 9. It seems that for whatever reason the site is trying to parse an image开发者_开发技巧 file into the database or something like that.
Any help will be appreciated.
Thanks
Are you using <cfqueryparam>
?
I would guess that you may have something like this:
<cfquery param value="#myVar#" cfsqltype="cf_sqltype_integer" />
the cfsqltype should be cf_sqltype_varchar.
If that is not the case, then please update your post with the offending code. That would be very helpful.
I think we would need more of the error details like the line of code on which the error occurs or maybe the whole template to be much help. In the absence of more information, Jason's answer seems likely.
This sounds to me like you may have a query where you are trying to concatenate a nvarchar column with an int column.
Such as
SELECT MyString + MyInt FROM MyTable
Unfortunatly SQL Server does not implicitly convert integers to varchar for concatenation, so you will need to convert your integer.
SELECT MyString + Convert(varchar(20), MyInt) FROM MyTable
or
SELECT MyString + Cast(MyInt AS varchar(20)) FROM MyTable
精彩评论