Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
|
Just to explain to you, the problem was the datatypes of your db columns.
id is referenced as an integer (or a variant: bigint, smallint) and can only contain integer numbers.
urlid is a varchar field.
A numeric field is referenced as is, without quotes
Code:
select * from tableX where intField=5;
If you want to look up a varchar value, you have to enclose the term into single quotes.
Code:
select * from tableX where strField='something';
If you try to make a query on an integer field with a varchar value, then the db will try to implicitly cast your varchar in an integer value
Code:
select * from tableX where intField='5';
It works, but requires a little bit more work for the db.
But, the db won't cast a integer to varchar implicitely, so, when you do
Code:
select * from tableX where strField=5;
the db raises an error because you try to compare a string value with an integer value.
What you should have written was
Code:
select * from tableX where strField='5';
Thus your error.
__________________
Only a biker knows why a dog sticks his head out the window.
Last edited by tripy; 03-28-2009 at 08:09 AM..
|