[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 205
  • Last Modified:

error:Expected end of statement

what is wrong here:
 mySQL="UPDATE demo SET filed=1 WHERE id = " & deletionList[i]

?

dim ppermit,deletionList
ppermit=request.form("fordeletion")
 
If ppermit<>"" then
 
deletionList = Split("deletionList", ", ")
dim mySQLp, conntempp, rstempp
For i=0 To UBound(deletionList)
  mySQLp="UPDATE demo SET filed=DATE_ADD(LOCALTIME(),INTERVAL 420 minute) WHERE id = " & deletionList[i]
 call updateDatabase(mySQLp, rstempp, "modipexe.asp") 
 response.redirect "opo.asp"
Next
 
End if

Open in new window

0
sasha85
Asked:
sasha85
1 Solution
 
sasha85Author Commented:
there will be always new query because i am using FOR...then i need to give each one spacial name:
For i=0 To UBound(deletionList)
  mySQLp & i="UPDATE demo SET filed=1 WHERE id = " & deletionList[i]
 call updateDatabase(mySQLp & i, rstempp & i, "modipexe" & i)
Next

and that not working as well...i got syntax error
0
 
sonchoyCommented:
what is deletionList[i]? is it a field or any control in form?
if it is a field name, you should use [tablename].[fieldname]
You also should write Next i
0
 
sasha85Author Commented:
deletionList is a list of id's...
for example
deletionList= 1, 2, 3, 4
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
sasha85Author Commented:
0
 
b0lsc0ttIT ManagerCommented:
sasha85,

What if you don't use the For and just run it 1 time?  Do you still get the error?

What is the code for updateDatebase()?  That may be the place with the error.  If you copy the subroutine in to the loop and use it that way what is the result?

Let me know if you have any questions or need more information.

b0lsc0tt
0
 
sasha85Author Commented:
if i am using this one time(no array) its working...
but here is the all code:
(this kind of double question now...cause another question i posted got into this same point...)
i will be be glad if you follow me to
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/ASP/Q_23135462.html
:)

dim ppermit,deletionList
ppermit=request.form("fordeletion")
 
If ppermit<>"" then
 
deletionList = Split("ppermit", ", ")
dim mySQLp, conntempp, rstempp
For i=0 To UBound(deletionList)
  mySQLp="UPDATE mmo SET filed=1 WHERE id = " & deletionList(i)
 call updateDatabase(mySQLp, rstempp, "modipexe") 
Next
 
End if
 
 
----
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
 
[MySQL][ODBC 3.51 Driver][mysqld-4.1.21-community-nt]Unknown column 'ppermit' in 'where clause' 

Open in new window

0
 
jarwCommented:
A couple of possibilities here. First, don't put your variable name in double quotes in the Split function. You are attempting to split the string "ppermit" instead of the string STORED in the variable ppermit.

Secondly, if ppermit contains a comma-separated list of IDs, try getting rid of the Split stuff and the For loop altogether and just use this SQL statement:

mySQLp="UPDATE mmo SET filed=1 WHERE id IN(" & ppermit & ")"

So your resulting query would look something like this, and make all the updates you want to make with a single trip to the database:

UPDATE mmo SET filed=1 WHERE id IN(1, 2, 3, 4)

The complete code from your example is shown below with these modifications.
dim ppermit
ppermit=request.form("fordeletion")
 
If ppermit<>"" then
   dim mySQLp, conntempp, rstempp
   mySQLp="UPDATE mmo SET filed=1 WHERE id IN(" & ppermit & ")"
   call updateDatabase(mySQLp, rstempp, "modipexe") 
End if

Open in new window

0
 
sasha85Author Commented:
looking good!:)
0

Featured Post

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.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now