Issue using SQL string to do UPDATE

Posted on 2009-12-30
Last Modified: 2012-05-08
When I run the attached code I get the following error:

Microsoft OLE DB Provider for SQL Server error '80040e14'

Incorrect syntax near '('.

When I output newSQL I get:
UPDATE xxXXX set (userName,FirstName,LastName,password,emailAddress) Values('PhilG','Phil','Gxxxxxxon','12345','') WHERE AdminID = '5'
dim uname, fname, lname, password, emailAdd

	  uname = Request.Form("uname")

	  fname = Request.Form("fname")

	  lname = Request.Form("lname")

	  email = Request.Form("emailAdd")

	  password = Request.Form("password")


	Dim newSQL

	  newSQL = "UPDATE xxXXX set (userName,FirstName,LastName,password,emailAddress) Values('" & uname & "','"  & fname &  "','"  & lname &  "','"  & password & "','"  & email &  "') WHERE AdminID = '" & getUserID & "'"




	Set objRSupdate = Server.CreateObject("ADODB.Recordset")

	  objRSupdate.Open newSQL, objConn


	Response.Write("User has been added Updated.")

Open in new window

Question by:pGustafson
    LVL 142

    Accepted Solution

    the UPDATE syntax is differently:

    UPDATE yourtable
       SET field1 = value1, field2 = value2 . ..etc
     WHERE ...

    not that you REALLY should use adodb.command with parameters to avoid sql injection.


    Author Closing Comment

    Thank you for your quick response

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
    This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
    Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
    The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

    760 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

    8 Experts available now in Live!

    Get 1:1 Help Now