Solved

2 update command

Posted on 2004-04-22
6
185 Views
Last Modified: 2010-04-25
working on these 2 updates  and i get this error
Microsoft OLE DB Provider for ODBC Drivers error '80040e07'

[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the varchar value 'varidofteam' to a column of data type int.

/2004standings/update3.asp, line 78


<%

set Command1 = Server.CreateObject("ADODB.Command")
Command1.ActiveConnection = MM_girls_STRING
Command1.CommandText = "UPDATE dbo.gameresults  SET goalsinfavor='vargoalsinfavor', goalsagainst='vargoalsagainst', points='varpoints', win='varwin', tie='vartie', loss='varloss'  WHERE idofteam ='varidofteam' and juego = 'vargamenumero'"
Command1.CommandType = 1
Command1.CommandTimeout = 0
Command1.Prepared = true
Command1.Execute()

%>
<%

set Command2 = Server.CreateObject("ADODB.Command")
Command2.ActiveConnection = MM_girls_STRING
Command2.CommandText = "UPDATE dbo.gameresults  SET goalsinfavor='vargoalsinfavorv', goalsagainst=vargoalsagainstv, points='varpointsv', win='varwinv', tie='vartiev', loss='varlossv'  WHERE idofteam ='varidofteamv' and juego = 'vargamenumero'"
Command2.CommandType = 1
Command2.CommandTimeout = 0
Command2.Prepared = true
Command2.Execute()

%>

my variables look like this

<% If Request("Submit2") <> "" Then %>
<%

if(request("juego") <> "") then Command1__vargamenumero = request("juego")

if(request("idhome") <> "") then Command1__varidofteam = request("idhome")

if(request("scorehome") <> "") then Command1__vargoalsinfavor = request("scorehome")

if(request("scorevisit") <> "") then Command1__vargoalsagainst = request("scorevisit")

if(request("phome") <> "") then Command1__varpoints = request("phome")



if(request("winh") <> "") then Command1__varwin = request("winh")

if(request("tieh") <> "") then Command1__vartie = request("tieh")

if(request("lossh") <> "") then Command1__varloss = request("lossh")

if(request("homegameplayed") <> "") then Command1__vargameplayed = request("homegameplayed")

if(request("idvisit") <> "") then Command2__varidofteamv = request("idvisit")

if(request("scorevisit") <> "") then Command2__vargoalsinfavorv = request("scorevisit")

if(request("scorehome") <> "") then Command2__vargoalsagainstv = request("scorehome")

if(request("pvisit") <> "") then Command2__varpointsv = request("pvisit")

if(request("winv") <> "") then Command2__varwinv = request("winv")

if(request("tiev") <> "") then Command2__vartiev = request("tiev")

if(request("lossv") <> "") then Command2__varlossv = request("lossv")

if(request("visitgameplayed") <> "") then Command2__vargameplayedv = request("visitgameplayed")

%>
<%

if(request("juego") <> "") then Command3__varperro = request("juego")

%>


is there something that i am doing wrong?

it looks ok to me
0
Comment
Question by:gianitoo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 35

Assisted Solution

by:mrichmon
mrichmon earned 250 total points
ID: 10892350
The problem is that you are sending a string value (notice how it is in quotes) to a table column that is set up as an integer (i.e. a number).

That is why the error is being thrown.
0
 
LVL 23

Accepted Solution

by:
Saqib Khan earned 250 total points
ID: 10894237
what is the Data type of idofteam Column in your Table?

I assume you using Ms Sql Server? if yes then its ok to Treat the Value as String with Single Quotes around it, but make sure atleast the Value is an INT(Number).
0
 
LVL 35

Expert Comment

by:mrichmon
ID: 10894938
No it is not okay because he is not putting quotes around a value - maybe that was the intent, but it is actually sending in the string 'varidofteam' not the value of the variable varidofteam enclosed in quotes.
0
Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

 
LVL 23

Expert Comment

by:Saqib Khan
ID: 10896340
I assume varidofteam is not a Variable, cuz its enclosed in Single Quotes.
0
 
LVL 1

Author Comment

by:gianitoo
ID: 10900111
this is how i solved it

<%

set Command1 = Server.CreateObject("ADODB.Command")
Command1.ActiveConnection = MM_girls_STRING
Command1.CommandText = "UPDATE dbo.gameresults  SET goalsinfavor=" & request("scorehome") & ", goalsagainst=" & request("scorevisit") & ", points=" & request("phome") & ", win=" & request("winh") & ", tie=" & request("tieh") & ", loss=" & request("lossh") & " WHERE idofteam =" & request("idhome") & " and juego = " & request("juego") & " "
Command1.CommandType = 1
Command1.CommandTimeout = 0
Command1.Prepared = true
Command1.Execute()

%>
<%

set Command2 = Server.CreateObject("ADODB.Command")
Command2.ActiveConnection = MM_girls_STRING
Command2.CommandText = "UPDATE dbo.gameresults  SET goalsinfavor=" & request("scorevisit") & ", goalsagainst=" & request("scorehome") & ", points=" & request("pvisit") & ", win=" & request("winv") & ", tie=" & request("tiev") & ", loss=" & request("lossv") & "  WHERE idofteam =" & request("idvisit") & " and juego = " & request("juego") & " "
Command2.CommandType = 1
Command2.CommandTimeout = 0
Command2.Prepared = true
Command2.Execute()

%>
0
 
LVL 35

Expert Comment

by:mrichmon
ID: 10900356
Yes that is because now you are sending in the value of the variables and not the sting of the name of the variable.

Often when you get that error message it is a clue that you are sending in the variable name rather than the value stored in the variable.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those who don't know, Adobe Dreamweaver is a popular commercial web editor that enables you to design, build and manage complex websites. The editor is a WYSIWYG (What You See Is What You Get) web editor, which means that you can create your web…
This article is very specific and is only intended to help if you are installing Dreamweaver 8 in a Windows 7 environment with Office 2007 installed.   I'm not sure why Microsoft tends to release OS' that should not be released but they do.  Windows…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question