Hi, I am assiging a the count(*) from a database query to a variable.But it is giving this error Error Type: Microsoft VBScript runtime (0x800A000D) Type mismatch Code (markup): the query is here sql="select count(*) from tablename where row=somevalue " set ObjRS=cn.execute(sql) dim variable variable=ObjRS(0) if variable <> 0 then 'Here i am getting an error mentioned 'above end if Code (markup):
What data type is the column named "row" in the db? How is this value being populated in the query? What database are you using (access, MS SQL, MySQL etc)?
Beware the dreaded NULL value! NULL <> 0 if in doubt if not isnull(variable) then if variable <> 0 then . . endif endif will prevent this
Just put a cint(variable)<>0 then it will work!! By default it will take as string!!! What a junk ;-)