Solved

2 update command

Posted on 2004-04-22
6
166 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
  • 3
  • 2
6 Comments
 
LVL 35

Assisted Solution

by:mrichmon
mrichmon earned 250 total points
Comment Utility
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:
adilkhan earned 250 total points
Comment Utility
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
Comment Utility
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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 23

Expert Comment

by:adilkhan
Comment Utility
I assume varidofteam is not a Variable, cuz its enclosed in Single Quotes.
0
 
LVL 1

Author Comment

by:gianitoo
Comment Utility
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
Comment Utility
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

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…
Adobe Dreamweaver CS5 is a WYSIWYG web page editor that has advanced HTML, CSS, and Javascript rendering functionality and is probably the most well-known HTML editor available. Much of Dreamweaver's appeal centers around the Design View interfac…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

763 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now