IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

ASP Discussion :

Erreur de syntaxe dans l'instruction UPDATE


Sujet :

ASP

  1. #1
    Membre du Club
    Inscrit en
    Mars 2005
    Messages
    158
    Détails du profil
    Informations forums :
    Inscription : Mars 2005
    Messages : 158
    Points : 65
    Points
    65
    Par défaut Erreur de syntaxe dans l'instruction UPDATE
    Bonjour

    j'ai un souci, je trouve pas l'erreur, j'utilise la fonction "Mise a Jour", et le champs en question est
    capacite_congelée_(froid)
    Es ce les parentaise qui ne plait pas?

    voila mon message d'erreur dans mon explorateur

    Type d'erreur :
    Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
    [Microsoft][Pilote ODBC Microsoft Access] Erreur de syntaxe dans l'instruction UPDATE.
    /aideperso/modif/modif_pda.asp, line 111


    Type de navigateur :
    Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)

    Page :
    POST 41 bytes to /aideperso/modif/modif_pda.asp

    POST Data:
    capcong=a&MM_update=form1&MM_recordId=115
    et voila mon code

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    <%@LANGUAGE="VBSCRIPT"%>
    <!--#include file="../../Connections/TarifPRO.asp" -->
    <%
    ' *** Edit Operations: declare variables
     
    Dim MM_editAction
    Dim MM_abortEdit
    Dim MM_editQuery
    Dim MM_editCmd
     
    Dim MM_editConnection
    Dim MM_editTable
    Dim MM_editRedirectUrl
    Dim MM_editColumn
    Dim MM_recordId
     
    Dim MM_fieldsStr
    Dim MM_columnsStr
    Dim MM_fields
    Dim MM_columns
    Dim MM_typeArray
    Dim MM_formVal
    Dim MM_delim
    Dim MM_altVal
    Dim MM_emptyVal
    Dim MM_i
     
    MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
    If (Request.QueryString <> "") Then
      MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
    End If
     
    ' boolean to abort record edit
    MM_abortEdit = false
     
    ' query string to execute
    MM_editQuery = ""
    %>
    <%
    ' *** Update Record: set variables
     
    If (CStr(Request("MM_update")) = "form1" And CStr(Request("MM_recordId")) <> "") Then
     
      MM_editConnection = MM_TarifPRO_STRING
      MM_editTable = "Intitule"
      MM_editColumn = "N°"
      MM_recordId = "" + Request.Form("MM_recordId") + ""
      MM_editRedirectUrl = ""
      MM_fieldsStr  = "capcong|value"
      MM_columnsStr = "capacite_congelée_(froid)|none,none,NULL"
     
      ' create the MM_fields and MM_columns arrays
      MM_fields = Split(MM_fieldsStr, "|")
      MM_columns = Split(MM_columnsStr, "|")
     
      ' set the form values
      For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
        MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
      Next
     
      ' append the query string to the redirect URL
      If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
        If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
          MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
        Else
          MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
        End If
      End If
     
    End If
    %>
    <%
    ' *** Update Record: construct a sql update statement and execute it
     
    If (CStr(Request("MM_update")) <> "" And CStr(Request("MM_recordId")) <> "") Then
     
      ' create the sql update statement
      MM_editQuery = "update " & MM_editTable & " set "
      For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
        MM_formVal = MM_fields(MM_i+1)
        MM_typeArray = Split(MM_columns(MM_i+1),",")
        MM_delim = MM_typeArray(0)
        If (MM_delim = "none") Then MM_delim = ""
        MM_altVal = MM_typeArray(1)
        If (MM_altVal = "none") Then MM_altVal = ""
        MM_emptyVal = MM_typeArray(2)
        If (MM_emptyVal = "none") Then MM_emptyVal = ""
        If (MM_formVal = "") Then
          MM_formVal = MM_emptyVal
        Else
          If (MM_altVal <> "") Then
            MM_formVal = MM_altVal
          ElseIf (MM_delim = "'") Then  ' escape quotes
            MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
          Else
            MM_formVal = MM_delim + MM_formVal + MM_delim
          End If
        End If
        If (MM_i <> LBound(MM_fields)) Then
          MM_editQuery = MM_editQuery & ","
        End If
        MM_editQuery = MM_editQuery & MM_columns(MM_i) & " = " & MM_formVal
      Next
      MM_editQuery = MM_editQuery & " where " & MM_editColumn & " = " & MM_recordId
     
      If (Not MM_abortEdit) Then
        ' execute the update
        Set MM_editCmd = Server.CreateObject("ADODB.Command")
        MM_editCmd.ActiveConnection = MM_editConnection
        MM_editCmd.CommandText = MM_editQuery
        MM_editCmd.Execute
        MM_editCmd.ActiveConnection.Close
     
        If (MM_editRedirectUrl <> "") Then
          Response.Redirect(MM_editRedirectUrl)
        End If
      End If
     
    End If
    %>
    <%
    Dim modif_pda__MMColParam
    modif_pda__MMColParam = "1"
    If (Request.QueryString("N°") <> "") Then 
      modif_pda__MMColParam = Request.QueryString("N°")
    End If
    %>
    <%
    Dim modif_pda
    Dim modif_pda_numRows
     
    Set modif_pda = Server.CreateObject("ADODB.Recordset")
    modif_pda.ActiveConnection = MM_TarifPRO_STRING
    modif_pda.Source = "SELECT *  FROM pda_compl_froid  WHERE N° = " + Replace(modif_pda__MMColParam, "'", "''") + ""
    modif_pda.CursorType = 0
    modif_pda.CursorLocation = 2
    modif_pda.LockType = 1
    modif_pda.Open()
     
    modif_pda_numRows = 0
    %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title>Document sans titre</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style type="text/css">
    <!--
    .Style5 {
    	background-color: #0099CC;
    	color: #000000;
    	font-size: x-small;
    }
    .Style6 {
    	font-size: x-small;
    	background-color: #990099;
    }
    .Style7 {font-size: small}
    .Style8 {background-color: #0099CC; color: #000000; font-size: small; }
    .Style10 {
    	font-size: small;
    	font-weight: bold;
    	text-align: justify;
    }
    .Style11 {font-size: x-small}
    .Style12 {
    	font-size: small;
    	font-weight: bold;
    }
    -->
    </style>
    </head>
     
    <body>
    <div align="left"></div>
    <table width="350" border="0" align="left" cellpadding="0" cellspacing="0">
      <tr>
        <td width="412"><form method="POST" action="<%=MM_editAction%>" name="form1">
     
            <div align="center">
              <table width="346" align="center">
                <tr valign="baseline">
                  <td colspan="2" align="right" nowrap><span class="Style12"><%=(modif_pda.Fields.Item("Réference").Value)%></span></td>
                  <td width="3" rowspan="2">&nbsp;</td>
                  <td colspan="3" rowspan="2"><span class="Style7"><strong></strong></span> </td>
                  <td width="92">&nbsp;</td>
                </tr>
                <tr valign="baseline">
                  <td colspan="2" align="right" nowrap>              &euro;</td>
                  <td>&nbsp;</td>
                </tr>
                <tr valign="baseline">
                  <td colspan="7" align="right" nowrap><div align="center">intitulé:
     
                    </div></td>
                </tr>
                <tr valign="baseline">
                  <td colspan="7" align="right" nowrap><div align="center">
                      <input name="capcong" type="text" id="appareil4" value="<%=(modif_pda.Fields.Item("capacite_congelée_(froid)").Value)%>" size="15">
                  </div></td>
                </tr>
                <tr valign="baseline">
                  <td width="78" align="right" nowrap>&nbsp;</td>
                  <td width="42" align="right" nowrap>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td width="40"><span class="Style11">Haut</span></td>
                  <td width="3">&nbsp;</td>
                  <td width="57"><span class="Style11">Larg.</span></td>
                  <td><span class="Style11">Prof.</span></td>
                </tr>
                <tr valign="baseline">
                  <td align="right" nowrap>&nbsp;</td>
                  <td align="right" nowrap>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                </tr>
                <tr valign="baseline">
                  <td colspan="2" align="right" nowrap><span class="Style5 Style7">&euro;</span></td>
                  <td>&nbsp;</td>
                  <td colspan="4"><span class="Style8"></span></td>
                </tr>
                <tr valign="baseline">
                  <td align="right" nowrap>:</td>
                  <td align="right" nowrap>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td colspan="4"><span class="Style10"></span></td>
                </tr>
                <tr valign="baseline">
                  <td align="right" nowrap>&nbsp;</td>
                  <td colspan="6" align="right" nowrap>
                    <div align="center">
                      <input type="submit" value="Mettre &agrave; jour l'enregistrement">              
                    </div></td>
                </tr>
              </table>
     
    <input type="hidden" name="MM_update" value="form1">
    <input type="hidden" name="MM_recordId" value="<%= modif_pda.Fields.Item("N°").Value %>">
            </div>
            </form>
        <p align="left">&nbsp;</p></td>
      </tr>
      <tr>
        <td><div align="center"></div></td>
      </tr>
      <tr>
        <td><div align="center"></div>      <div align="center"></div></td>
      </tr>
    </table>
    <div align="center"></div>
    <div align="left"></div>
    </body>
    </html>
    <%
    modif_pda.Close()
    Set modif_pda = Nothing
    %>
    Merci d'avance encore pour votre aide

  2. #2
    Expert éminent
    Avatar de Immobilis
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Mars 2004
    Messages
    6 559
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Développeur .NET

    Informations forums :
    Inscription : Mars 2004
    Messages : 6 559
    Points : 9 506
    Points
    9 506
    Par défaut
    Salut,

    Il faut essayer d'etre le plus sobre possible dans le nommage de tes champs. La langue anglaise se prête bien à ça car elle ne comprte pas de caractères accentués. Les parenthèses sont à proscrire évidement. Contente toi des lettres de l'alphabet, éventuellement des chiffres et du souligné (underscore = "_").
    Si c'est trop compliqué de revenir sur les noms de tes champs tu peux éventuellement les entourer de crochets
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    [capacite_congelée_(froid)]
    mais bon, mieux vaut les retirer avant que ça t'explose à la figure.

    A+
    "Winter is coming" (ma nouvelle page d'accueil)

  3. #3
    Membre du Club
    Inscrit en
    Mars 2005
    Messages
    158
    Détails du profil
    Informations forums :
    Inscription : Mars 2005
    Messages : 158
    Points : 65
    Points
    65
    Par défaut
    Merci
    bon avec les [] ca marche pas
    mais c'est bien les () qui bloquent
    il est vraix que c'est une vielle architecture de base de donnée, 7ans
    je vais me mettre a enlever ces () ca va etre long mais plus sur pour l'avenir

    Merci encore

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Réponses: 4
    Dernier message: 29/05/2015, 11h13
  2. [Débutant] Erreur de syntaxe dans l'instruction update C# avec Access ?
    Par hamza_azerty dans le forum C#
    Réponses: 3
    Dernier message: 29/08/2014, 14h27
  3. [AC-2007] Erreur de syntaxe dans l'instruction UPDATE
    Par ahoure dans le forum VBA Access
    Réponses: 2
    Dernier message: 21/06/2014, 00h34
  4. [AC-2007] Erreur de syntaxe dans l'instruction UPDATE
    Par sebastien-16600 dans le forum Requêtes et SQL.
    Réponses: 6
    Dernier message: 22/12/2012, 14h14
  5. Erreur de syntaxe dans l'instruction ALTER TABLE
    Par cakeke dans le forum Access
    Réponses: 1
    Dernier message: 25/12/2006, 15h30

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo