Ask a Question related to Dreamweaver AppDev, Design and Development.
-
fiddlestyx #1
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
-
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... -
Check syntax gives strange errors
Two classes defined in two actionscripts: CollisionManager and CollidableInfo. Scripts are in the same package. CollisionManager creates an... -
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... -
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... -
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... -
CMBergin #2
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...that> 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 indicatesinstead> the problem is in the CommandText, or SQL string. I've tried removing the
> "Replace" function and using Chr(34) or other character substitutions> of the single quotes, but no luck.
>
> Can anyone shed any light as to how to correct this?
>
> Thanks.
>
CMBergin Guest



Reply With Quote

