ASP Command Object Syntax Errors

Ask a Question related to Dreamweaver AppDev, Design and Development.

  1. #1

    Default ASP Command Object Syntax Errors

    I'm having difficulty using a straight-forward ASP/VBScript Command Object
    generated by DMX04. The code is supposed to insert into a SQL Server 2000
    table, not a stored procedure. Dreamweaver writes the code as follows:

    <%

    set cmdAttachAdd = Server.CreateObject("ADODB.Command")
    cmdAttachAdd.ActiveConnection = connectionStringGoesHere
    cmdAttachAdd.CommandText = "INSERT INTO dbo.tableName (entryID, fileName)
    VALUES (" + Replace(cmdAttachAdd__varEntryID, "'", "''") + "," +
    Replace(cmdAttachAdd__varFileName, "'", "''") + ") "
    cmdAttachAdd.CommandType = 1
    cmdAttachAdd.CommandTimeout = 0
    cmdAttachAdd.Prepared = true
    cmdAttachAdd.Execute()

    %>

    ...plus the usual variable declarations, etc. The syntax error indicates that
    the problem is in the CommandText, or SQL string. I've tried removing the
    "Replace" function and using Chr(34) or other character substitutions instead
    of the single quotes, but no luck.

    Can anyone shed any light as to how to correct this?

    Thanks.

    fiddlestyx Guest

  2. Similar Questions and Discussions

    1. AS2: Extends with packages (works) but gives check syntax errors (seems to be a bug)
      I have two files in a package called PTMW. They both live in the same project. PTMW.TopoSprite.as PTMW.Sprite.as They live in the correct...
    2. Check syntax gives strange errors
      Two classes defined in two actionscripts: CollisionManager and CollidableInfo. Scripts are in the same package. CollisionManager creates an...
    3. Command line Syntax
      Hi, I want to do a simple search replace on a unix command prompt. What i require is a syntax to do is? echo "I am Manish"|<perl command> output...
    4. Grant Command Syntax
      I've got a MySQL database which contains users and their passwords. I have a PHP script that allows me to add new users and passwords to the...
    5. finding syntax errors
      I've painted myself into a corner I can't get out of... Missing right curly or square bracket at /home/pfeiffer/bin/trash line 341, at end of...
  3. #2

    Default Re: ASP Command Object Syntax Errors

    What's your error?
    In all liklihood, your parameter values don't exist. You have no single
    quotes around the values, so they're numbers. If a number parameter doesn't
    exist, then the statement will error out. If you pass a text string into a
    number parameter, the statement will error out.

    "fiddlestyx" <webforumsuser@macromedia.com> wrote in message
    news:cv5evv$1o$1@forums.macromedia.com...
    > I'm having difficulty using a straight-forward ASP/VBScript Command Object
    > generated by DMX04. The code is supposed to insert into a SQL Server 2000
    > table, not a stored procedure. Dreamweaver writes the code as follows:
    >
    > <%
    >
    > set cmdAttachAdd = Server.CreateObject("ADODB.Command")
    > cmdAttachAdd.ActiveConnection = connectionStringGoesHere
    > cmdAttachAdd.CommandText = "INSERT INTO dbo.tableName (entryID, fileName)
    > VALUES (" + Replace(cmdAttachAdd__varEntryID, "'", "''") + "," +
    > Replace(cmdAttachAdd__varFileName, "'", "''") + ") "
    > cmdAttachAdd.CommandType = 1
    > cmdAttachAdd.CommandTimeout = 0
    > cmdAttachAdd.Prepared = true
    > cmdAttachAdd.Execute()
    >
    > %>
    >
    > ...plus the usual variable declarations, etc. The syntax error indicates
    that
    > the problem is in the CommandText, or SQL string. I've tried removing the
    > "Replace" function and using Chr(34) or other character substitutions
    instead
    > of the single quotes, but no luck.
    >
    > Can anyone shed any light as to how to correct this?
    >
    > Thanks.
    >

    CMBergin Guest

Posting Permissions

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

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