Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

2 update command

Posted on 2004-04-22
6
Medium Priority
?
203 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 750 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 750 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
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

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…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

604 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