Forums
This topic is locked
Problem With hit Counter update stored procedure
15 Apr 2007 13:05:52 ng anthor posted:
<img src="www.geocities.com/chinye2020/Error.GIF" border=0>i wan to update my hits column
i get this error=.=
Error Type:
Microsoft JET Database Engine (0x80040E07)
Data type mismatch in criteria expression.
/test/details.asp, line 37
Edited by - anthor on 15 Apr 2007 13:07:31
Edited by - anthor on 15 Apr 2007 13:08:09
Replies
Replied 17 Apr 2007 01:28:42
17 Apr 2007 01:28:42 ng anthor replied:
Problem solved after i change to this-------------------
UPDATE WtNames
SET Downloads = Downloads + 1
WHERE numID <b>LIKE 'abc' </b>
<img src=../images/dmxzone/forum/icon_smile_cool.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile_cool.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile_cool.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile_cool.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile_cool.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile_cool.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile_cool.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile_cool.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile_cool.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile_cool.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile_cool.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile_cool.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile_cool.gif border=0 align=middle>
<font size=5><b>BUT I DONT UNDERSTAND WAT DIFFERENT WITH = AND LIKE??WHO CAN TELL ME PLS?
</b></font id=size5>
UPDATE WtNames
SET Downloads = Downloads + 1
WHERE numID <b>LIKE 'abc' </b>
<img src=../images/dmxzone/forum/icon_smile_cool.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile_cool.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile_cool.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile_cool.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile_cool.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile_cool.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile_cool.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile_cool.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile_cool.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile_cool.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile_cool.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile_cool.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile_cool.gif border=0 align=middle>
<font size=5><b>BUT I DONT UNDERSTAND WAT DIFFERENT WITH = AND LIKE??WHO CAN TELL ME PLS?
</b></font id=size5>
Replied 18 Apr 2007 09:24:17
18 Apr 2007 09:24:17 Dave Clarke replied:
the problem you had was to do with your single quotes around the variable name... in the first instance you haven't got any so it didn't work, in the second example you have got single quotes round the variable name so it does work.
In your example you <b>don't</b> want to use LIKE because LIKE is used as a wildcard search operator.. so in your example
<b>UPDATE WtNames
SET hits = hits+1
WHERE numID = 'PARAMID'</b>
would do what your are trying to do.. but
<b>UPDATE WtNames
SET hits = hits+1
WHERE numID LIKE 'PARAMID'</b>
would not because it would update every record that has the variable value in it... lets say numID is 41.. so PARAMID is 41 then LIKE 'PARAMID' would find 41, 141, 412 etc. Whereas = would only find 41
hope that makes sense
DW8.02|ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome.
www.reunite.co.uk
www.dogworld-uk.com
Edited by - Davecl on 18 Apr 2007 09:25:51
In your example you <b>don't</b> want to use LIKE because LIKE is used as a wildcard search operator.. so in your example
<b>UPDATE WtNames
SET hits = hits+1
WHERE numID = 'PARAMID'</b>
would do what your are trying to do.. but
<b>UPDATE WtNames
SET hits = hits+1
WHERE numID LIKE 'PARAMID'</b>
would not because it would update every record that has the variable value in it... lets say numID is 41.. so PARAMID is 41 then LIKE 'PARAMID' would find 41, 141, 412 etc. Whereas = would only find 41
hope that makes sense
DW8.02|ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome.
www.reunite.co.uk
www.dogworld-uk.com
Edited by - Davecl on 18 Apr 2007 09:25:51