Update a Table - PLEASE HELP!!!

Results 1 to 3 of 3

Thread: Update a Table - PLEASE HELP!!!

  1. #1
    Jyotsna Guest

    Default Update a Table - PLEASE HELP!!!

    Please help. I am getting an error that says<BR>Microsoft OLE DB Provider for ODBC Drivers error &#039 80040e14&#039 <BR>[Microsoft][ODBC Microsoft Access 97 Driver] Syntax error in UPDATE statement. <BR> <BR>My code is as simple as this:<BR>&#060;%@ Language=VBScript &#037;&#062;<BR><BR>&#060;!-- #INCLUDE FILE="adovbs.inc" --><BR>&#060;HTML><BR>&#060;HEAD><BR>&#060;META NAME="GENERATOR" Content="Microsoft Developer Studio"><BR>&#060;META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1"><BR>&#060;TITLE>Modify the scenario&#060;/TITLE><BR>&#060;META NAME="AUTHOR" CONTENT="Jyotsna"><BR>&#060;/HEAD><BR>&#060;BODY><BR>&#060;%<BR>ScenarioTitle = request.form ("ScenarioTitle")<BR>Desc = request.form ("Desc")<BR>Set MyConn = Server.CreateObject("ADODB.Connection")<BR>Set RS = Server.CreateObject("ADODB.Recordset")<BR>MyConn.O pen "db"<BR>Set RS = MyConn.Execute _<BR> ("SELECT * FROM [tblScenario] WHERE ScenarioTitle = &#039"& _<BR> Request.Form("ScenarioTitle")&"&#039")<BR>session ("ScenarioTitle") = request.form("ScenarioTitle")<BR>&#039(It has a problem with the next statement)<BR>Set RS = MyConn.Execute _<BR> ("UPDATE tblScenario SET Desc = &#039"&Desc&"&#039 WHERE <BR>ScenarioTitle = &#039"&ScenarioTitle&"&#039")<BR>&#037;&#062;<BR>& #060;p>Scenario modified successfully.<BR>&#060;/BODY><BR>&#060;/HTML><BR><BR>Thank you.

  2. #2
    mash Guest

    Default RE: Update a Table - PLEASE HELP!!!

    try putting the update statement in a variable and display the variable using response.write - like so...<BR>----------------<BR>dim sql<BR><BR>sql = "UPDATE tblScenario SET Desc = &#039"&Desc&"&#039 WHERE ScenarioTitle = &#039"&ScenarioTitle&"&#039"<BR><BR>response.write (sql)<BR>----------------<BR><BR>also, it appears that you have missed out the continuation character in first line of your UPDATE statement - maybe that&#039s the problem?

  3. #3
    Join Date
    Dec 1969
    Posts
    119

    Default RE: Update a Table - PLEASE HELP!!!

    It is always better if you collect the formfields in variables, declare a variable to store your SQL query and then pass them as parameter to your RS and Connection. Apparently that may be the problem.<BR>Arvind

Posting Permissions

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