Saturday, March 06, 2010
Coldfusion Error: Value can not be converted to requested type.
Have you ever encountered this error? Well I did today. It wasn’t the first time either. In my SELECT statement I was using “SELECT * FROM tblname WHERE ID =
Seems coldfusion has a problem with this after I added a new column to the table i was querying.
The solution is when you write your SELECT statement you should not use *. Instead consider listing out each and every column name in your query. This will prevent the error from occuring, but if you ever add another column to your table you have to rewrite that query. That kinda sucks.
You can also remove the cfqueryparam from your SELECT statement and that will fix it too (actually this is what I think is the root of the problem because the query runs perfectly without cfqueryparam - it only breaks when i’m using cfqueryparam and i modify the table.)
Read this article on this error: