Solved

2 update command

Posted on 2004-04-22
6
174 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
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
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

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…
I still run into .cgi files every now and then. In some instances, I actually prefer the simplicity of a .cgi script to other options. Since I use DreamWeaver extensively, what I needed was a way to open .cgi scripts in Dreamweaver. And I wanted to …
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

832 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