Error: Expected End of Statement

Asked

Viewed 300 times

1

I’m using SQL for a classic ASP page and in a part of the code I have this:

            If (opcao = 1) Then
        If credito > 0 Then
            SQL = "UPDATE FO_Passaportes SET creditoTotal = creditoTotal + " & credito & " WHERE IDPassaporte = " & IDPassaporte & ""
        Else
            SQL = "UPDATE FO_Passaportes SET creditoUsado = creditoUsado + " & Abs(credito) & " WHERE IDPassaporte = " & IDPassaporte & ""
        End If
        End If
        If (opcao = 2) Then
            SQL = "UPDATE FO_Passaportes SET creditoTotal = creditoTotal - " & Abs(credito) & " WHERE IDPassaporte = " & ID Passaporte & ""
        End If

When I run I’m getting the following error:

Microsoft Vbscript Compilation error '800a0401'

Expected end of statement

/GIP-Ep/Training/passports/passport.Sp, line 234

SQL = "UPDATE Fo_passports SET creditTotal = creditTotal - " & Abs(credit) & " WHERE Idpassport = " & ID Passport & ""----------------------------------------------------------------------------------------------------------------^

The error is pointing to my last query:

        If (opcao = 2) Then
        SQL = "UPDATE FO_Passaportes SET creditoTotal = creditoTotal - " & Abs(credito) & " WHERE IDPassaporte = " & ID Passaporte & ""
    End If

What I’m doing wrong??

  • 1

    I don’t believe there’s that space in ID Passaporte

  • @You are right Thank you xD >.<

1 answer

2


There’s a space here ID Passaporte, right is IDPassaporte.

The code in general is confusing and can be simplified, which helps to identify more these problems.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.