<% lstCompany = request.Form("lstCompany") ContractID = request.Form("ContractID") Set conn = server.createobject("ADODB.Connection") 'sets the connection conn.open strconn ' opens the connection 'sql = "UPDATE Contact SET Password = '" & ContractID & "' WHERE Company_Name = '" & lstCompany & "'" sql = "UPDATE Contact SET Password = '177TM0605' WHERE Company_Name = 'Test Company'" 'response.write sql 'response.end set rs = conn.execute(sql) %> <% ' close and destroy all connections conn.close set conn = nothing %> [allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => [ref] => [htmlstate] => on_nl2br [postusername] => Steven [ip] => [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 1 [islastshown] => [isfirstshown] => 1 [attachments] => [allattachments] => ) --> > <% > lstCompany = request.Form("lstCompany") > ContractID = request.Form("ContractID") > > Set conn = server.createobject("ADODB.Connection") 'sets the connection > conn.open strconn ' opens the connection > > 'sql = "UPDATE Contact SET Password = '" & ContractID & "' WHERE > Company_Name = '" & lstCompany & "'" > sql = "UPDATE Contact SET Password = '177TM0605' WHERE Company_Name =[/ref] 'Test[ref] > Company'" > 'response.write sql > 'response.end > set rs = conn.execute(sql) > %> > > > <% > ' close and destroy all connections > conn.close > set conn = nothing > %> > >[/ref] [allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => [ref] => [htmlstate] => on_nl2br [postusername] => Aaron [ip] => ten.xoc@dnartre [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 2 [islastshown] => [isfirstshown] => [attachments] => [allattachments] => ) --> > > <% > > lstCompany = request.Form("lstCompany") > > ContractID = request.Form("ContractID") > > > > Set conn = server.createobject("ADODB.Connection") 'sets the connection > > conn.open strconn ' opens the connection > > > > 'sql = "UPDATE Contact SET Password = '" & ContractID & "' WHERE > > Company_Name = '" & lstCompany & "'" > > sql = "UPDATE Contact SET Password = '177TM0605' WHERE Company_Name =[/ref] > 'Test[ref] > > Company'" > > 'response.write sql > > 'response.end > > set rs = conn.execute(sql) > > %> > > > > > > <% > > ' close and destroy all connections > > conn.close > > set conn = nothing > > %> > > > >[/ref] > >[/ref] [allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => [ref] => [htmlstate] => on_nl2br [postusername] => Steven [ip] => [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 3 [islastshown] => 1 [isfirstshown] => [attachments] => [allattachments] => ) --> syntax error in update but works fine in access - ASP Database

syntax error in update but works fine in access - ASP Database

I am getting a syntax error in my SQL statement, i have written it to the screen and pasted into access and it runs no problems, i have also copied the generated sql into the sql variable and tried running that and it still falls over, cant for the life me understand why i it errors thanks in advance the error is a.. Error Type: Microsoft JET Database Engine (0x80040E14) Syntax error in UPDATE statement. /OSA/updatecontracts2.asp, line 23 a.. Browser Type: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; supplied by tiscali) a.. Page: POST 69 bytes to /OSA/updatecontracts2.asp a.. POST ...

  1. #1

    Default syntax error in update but works fine in access

    I am getting a syntax error in my SQL statement, i have written it to the
    screen and pasted into access and it runs no problems, i have also copied
    the generated sql into the sql variable and tried running that and it still
    falls over, cant for the life me understand why i it errors

    thanks in advance

    the error is

    a.. Error Type:
    Microsoft JET Database Engine (0x80040E14)
    Syntax error in UPDATE statement.
    /OSA/updatecontracts2.asp, line 23


    a.. Browser Type:
    Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; supplied by tiscali)

    a.. Page:
    POST 69 bytes to /OSA/updatecontracts2.asp

    a.. POST Data:
    lstCompany=Vesuvius+UK+Ltd&contractID=177TM0605&Su bmit=Select+Company

    a.. Time:
    07 September 2004, 17:58:04

    here is my code

    <%LANGUAGE="VBSCRIPT"%>
    <% option explicit %>
    <%
    dim conn ' the connection variable
    dim strconn 'the database connection string
    dim physicaldbpath ' variable to hold the physical path of the db
    dim rs, sql, f, qsRef, lstCompany, ContractID

    physicaldbpath = server.mappath("..") 'the physical path of the db
    %>
    <!--#include file="connstring.inc"-->
    <%
    lstCompany = request.Form("lstCompany")
    ContractID = request.Form("ContractID")

    Set conn = server.createobject("ADODB.Connection") 'sets the connection
    conn.open strconn ' opens the connection

    'sql = "UPDATE Contact SET Password = '" & ContractID & "' WHERE
    Company_Name = '" & lstCompany & "'"
    sql = "UPDATE Contact SET Password = '177TM0605' WHERE Company_Name = 'Test
    Company'"
    'response.write sql
    'response.end
    set rs = conn.execute(sql)
    %>


    <%
    ' close and destroy all connections
    conn.close
    set conn = nothing
    %>


    Steven Guest

  2. #2

    Default Re: syntax error in update but works fine in access

    Use [] around password, it's a keyword.

    UPDATE Contact SET [Password] = ...

    --
    http://www.aspfaq.com/
    (Reverse address to reply.)




    "Steven Scaife" <fddsfsf> wrote in message
    news:phx.gbl... 
    still 
    'Test 


    Aaron Guest

  3. #3

    Default Re: syntax error in update but works fine in access

    thank you very much, better sort that out at some point then

    "Aaron [SQL Server MVP]" <noraa> wrote in message
    news:phx.gbl... [/ref]
    the [/ref]
    copied 
    > still 
    > 'Test 
    >
    >[/ref]


    Steven Guest

Similar Threads

  1. HELP SQL Update syntax error in windows2003 but works fine in NT4???
    By burnsaster@gmail.com in forum Coldfusion Database Access
    Replies: 0
    Last Post: February 14th, 07:32 PM
  2. Syntax error in update
    By benkayuk in forum Macromedia ColdFusion
    Replies: 16
    Last Post: April 22nd, 07:53 PM
  3. Replies: 0
    Last Post: September 10th, 02:43 PM
  4. Replies: 25
    Last Post: August 21st, 09:01 PM
  5. syntax error on update
    By bbxrider in forum ASP Database
    Replies: 0
    Last Post: July 22nd, 08:51 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •