?
Solved

2 update command

Posted on 2004-04-22
6
Medium Priority
?
194 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
New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn 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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

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…
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 we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses
Course of the Month12 days, 10 hours left to enroll

777 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