Get ready for BLACK FRIDAY shopping starting in

Forums

ASP

This topic is locked

Stored Procedure Error

Posted 02 May 2004 17:28:22
1
has voted
02 May 2004 17:28:22 Chad Cullum posted:
My app works with the following code:

set updateWin = Server.CreateObject("ADODB.Command"
updateWin.ActiveConnection = MM_connEPHOAladder_STRING
updateWin.CommandText = "UPDATE Rankings SET Wins = " & NewWcount & " WHERE Participant = '" + Replace(updateWin__MMWinParam, "'", "''" + "' "
updateWin.CommandType = 1
updateWin.CommandTimeout = 0
updateWin.Prepared = true
updateWin.Execute()

But when I add the following (in bold)

set updateWin = Server.CreateObject("ADODB.Command"
updateWin.ActiveConnection = MM_connEPHOAladder_STRING
updateWin.CommandText = "UPDATE Rankings SET Wins = " & NewWcount & "<b>, PlayerRank = " & Request.Form("Wranking" & "</b> WHERE Participant = '" + Replace(updateWin__MMWinParam, "'", "''" + "' "
updateWin.CommandType = 1
updateWin.CommandTimeout = 0
updateWin.Prepared = true
updateWin.Execute()

I receive the following error on the UpdateWin.Execute() line:

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE statement.

All values are numeric but I tried surrounding in single quotes anyway with no luck. I also assigned Request.Form("Wranking" to a variable with no luck.

Anyone see what I'm doing wrong here? Thx.



Replies

Replied 02 May 2004 19:37:35
02 May 2004 19:37:35 Vince Baker replied:
Looks fine to me, however try replacing Request.Form("Wranking" with Request("Wranking"

Just to check, you are posting the form values from the previous page and not using the get method?

Just to keep the code clean, reaplce the & symbols with + symbols (shouldnt make any difference at all, but you know coding! it does some strange things.)

Regards
Vince

Visit my home: www.chez-vince.com

VBScript | ASP | HTML | SQL | Oracle | Hosting
Replied 02 May 2004 20:28:37
02 May 2004 20:28:37 Chad Cullum replied:
Thanks for the ideas Vince but this thing still isnt working. I know the form values are passing because they display in a response.write, and the '+' instead of '&' gave me an error on the updateWin.CommandText line.

Still sitting here just scratching my head. I even got desperate enough to try populating PlayerRank before Wins but no go there either.

Replied 02 May 2004 20:52:26
02 May 2004 20:52:26 Vince Baker replied:
just one thing, the participant in the where statement....is that a text field?

Regards
Vince

Visit my home: www.chez-vince.com

VBScript | ASP | HTML | SQL | Oracle | Hosting
Replied 02 May 2004 21:02:24
02 May 2004 21:02:24 Chad Cullum replied:
Yes participant is text - this thing works with just SETting just one value, I run into problems when I try to SET both...

<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
just one thing, the participant in the where statement....is that a text field?

Regards
Vince

Visit my home: www.chez-vince.com

VBScript | ASP | HTML | SQL | Oracle | Hosting
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

Replied 03 May 2004 11:08:10
03 May 2004 11:08:10 Vince Baker replied:
Here is some template code that I use for updates. I dont know why you code isnt working because I cannot see anything wrong at all. How about trying mine just to see if it works....

&lt;% 'Set update action variables
Dim Update1, strsql, strWcount, strWranking, strParticipant
strWcount = Request("your passed variable name"
strWranking = Request("Wranking"
strParticipant = Request("you passed variable name"
strsql = "update rankings set wins= " & strWcount & ", playerrank= " & strWranking & " where participant= '" & strParticipant & "'"
%&gt;


&lt;% 'Excecute Update action
set Update1 = Server.CreateObject("ADODB.Connection"
Update1.ConnectionString = MM_connEPHOAladder_STRING
Update1.Open
Update1.Execute strSQL
Update1.Close
Set Update1 = Nothing
%&gt;


Have a go, should work in theory (then again, so should yours! lol)

Regards
Vince

Visit my home: www.chez-vince.com

VBScript | ASP | HTML | SQL | Oracle | Hosting

Edited by - bakerv on 03 May 2004 11:24:30
Replied 04 May 2004 23:18:30
04 May 2004 23:18:30 Chad Cullum replied:
I've tried it but I still get the same error. Everything I read about my 80040e14' error code tells me that it has something to do with using a reserved word. Even though none of my variables are on those lists of reserved words I changed them anyway so they were preceded by 'var' and I still get the error. I'm about to give up...

Replied 05 May 2004 15:43:59
05 May 2004 15:43:59 Vince Baker replied:
are you sure there are no ' ' single quotes in the data u are trying to insert?

Also, list the field names if you like, this way one of us might have had problems with restrictions in the past. (i know I have had problems with that where they are not on the restricted word list!)

I tested my update action with some dummy data sent from a form and it worked fine. Maybe pasting your code is the answer

Regards
Vince

Visit my home: www.chez-vince.com

VBScript | ASP | HTML | SQL | Oracle | Hosting
Replied 07 May 2004 23:29:20
07 May 2004 23:29:20 Andrew Watson replied:
Aright chaps....

bhamchad,

comment out the line

updateWin.Execute()

Then Add

Response.Write(updateWin.CommandText)
Response.End()

then you can see the executing SQL and pinpoint the error...

Post the ouput here if it still wont work...

cheers

:: Son, im Thirty.... ::

Reply to this topic