Active Server Pages

Moderators: None (Apply to moderate this forum)
Number of threads: 1763
Number of posts: 4498

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
SQL Update in ASP Posted by Dave101 on 14 Aug 2002 at 7:45 AM
This is the code I have used. This works apart from when the line with the * next to it is added. I think I may have missed out a comma or something as trivial as that.

strProvider="DRIVER=Microsoft Access Driver (*.mdb); DBQ=C:\Inetpub\wwwroot\Web Site\SquashMetro.mdb;"
set conn = server.createobject("ADODB.Connection")
conn.Open strProvider

sqlstmt = "UPDATE PlayerResultsDiv1"
if GH1 = 3 then
Won = 1
sqlstmt = sqlstmt & " SET Won= Won + " & Won
else
Lost = 1
sqlstmt = sqlstmt & " SET Lost= Lost + " & Lost
end if

sqlstmt = sqlstmt & " Pts = Pts + " & GH1 **************


sqlstmt = sqlstmt & " WHERE PlayerID ='" & PH1 & "' "
Set RS = conn.execute(sqlstmt)

Thanks

Dave
Report
Re: SQL Update in ASP Posted by ljuba on 15 Aug 2002 at 10:15 AM
This message was edited by ljuba at 2002-8-15 10:15:55

If I understood, problem is in this line:

sqlstmt = sqlstmt & " WHERE PlayerID ='" & PH1 & "' "

I think PlayerID is numeric field You don't need ' around PH1

it should be:

sqlstmt = sqlstmt & " WHERE PlayerID =" & PH1 & " "

or

sqlstmt = sqlstmt & " WHERE PlayerID =" & PH1

LJUBA


Report
Re: SQL Update in ASP Posted by Dave101 on 16 Aug 2002 at 6:09 AM
PlayerID was a text field.

I found the problem. On the next line the statement had to start with a comma, for example

sqlstmt = sqlstmt & ",Pts = Pts + " & PResult

Thanks anyway



: If I understood, problem is in this line:
:
: sqlstmt = sqlstmt & " WHERE PlayerID ='" & PH1 & "' "
:
: I think PlayerID is numeric field You don't need ' around PH1
:
: it should be:
:
: sqlstmt = sqlstmt & " WHERE PlayerID =" & PH1 & " "
:
: or
:
: sqlstmt = sqlstmt & " WHERE PlayerID =" & PH1
:
: LJUBA
:
:
:




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.