Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Please Help UPDATE Problem

Author  Topic 

tdodnz
Starting Member

23 Posts

Posted - 2002-03-31 : 21:34:16
strADD = "UPDATE tblUsers.Pops FROM tblUsers WHERE tblUsers.ID = "' & strID & '" AND SET tblUsers.Pops = tblUsers.Pops '+.8'"

strRemove = "UPDATE tblUsers.Pops FROM tblUsers WHERE tblUsers.url = " & strURL & " AND SET tblUsers.Pops = tblUsers.Pops '-1'"

What is wrong i do not have time and im new to this so what do I do.



Edited by - tdodnz on 03/31/2002 21:57:35

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2002-03-31 : 21:46:57
Hi

It looks to me like you are not putting apostrophes on strings but putting them on integers. It needs to be the other way around.

ALso here is a tip. "i do not have time and Im new" is not a good reason. Don't be lazy. It's fine to ask for help, but at least give us the error message you are getting.

Damian
Go to Top of Page

tdodnz
Starting Member

23 Posts

Posted - 2002-03-31 : 21:56:38
Heres the error im getting if it helps

Microsoft JET Database Engine error '80040e14'

Syntax error in UPDATE statement.

And can you please give me a script example if possible, the reason that i do not have time is cause of school and the other thing is i've been trying to get this to go since february, and i can't figure it out ii know it is all little things that i missed but i can't find them.


Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2002-03-31 : 22:10:19
Did you try my suggestion ?

In your ASP, response.write your sql statement and try to run it in query analyzer.

Damian
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2002-03-31 : 22:17:01
From what you have it looks like the command you need is

UPDATE tblUsers SET Pops = Pops +.8 WHERE ID = <strID>

so

strADD = "UPDATE tblUsers SET Pops = Pops +.8 WHERE ID = '" & strID & "'"

looking at the remove maybe this should be

strADD = "UPDATE tblUsers SET Pops = Pops + 1 WHERE ID = " & strID

(not sure if you need quotes round strID - if it's an int you don't).
Why not put the statement in a stored proc and just pass a parameter.



==========================================
Cursors are useful if you don't know sql.
Beer is not cold and it isn't fizzy.

Edited by - nr on 03/31/2002 22:21:23
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2002-03-31 : 22:18:45
strRemove = "UPDATE tblUsers SET Pops = Pops - 1 WHERE tblUsers.url = '" & strURL & "'"

==========================================
Cursors are useful if you don't know sql.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -