From: ContainsCaffeine on
Hello

I have an ASP/SQL Server 2008 client management application. An ASP
textarea submits data to a varchar(max) field. In some cases the field
runs to thousands of characters.

The sql string is "UPDATE tblClients SET ClientNote = " &
frm("ClientNote") WHERE ClientID = " & lngClientID

The update fails with the error "Microsoft OLE DB Provider for SQL
Server error '80040e14' The identifier that starts with '<BLAH BLAH
BLAH>' is too long. Maximum length is 128.

Is anyone able to advise please on how I might update this field? I
have considered only allowing appends, but as the field can sometimes
contain factual errors, we really need to be able to edit and update
the complete field.

Kind Regards


Jennifer
From: Plamen Ratchev on
I am not sure but seems to me the SQL string you have does not concatenate properly. Try this:

"UPDATE tblClients SET ClientNote = " & frm("ClientNote") & " WHERE ClientID = " & lngClientID

But a better approach is to parameterize the query or use stored procedure with parameters. That way you do not have to
worry about SQL injection and data types can be interpreted correctly. Here is one reference:
http://aspnet101.com/tutorials.aspx?id=1

--
Plamen Ratchev
http://www.SQLStudio.com
From: ContainsCaffeine on
On Mar 9, 12:54 am, Plamen Ratchev <Pla...(a)SQLStudio.com> wrote:
> I am not sure but seems to me the SQL string you have does not concatenate properly. Try this:
>
> "UPDATE tblClients SET ClientNote = " & frm("ClientNote") & " WHERE ClientID = " & lngClientID
>
> But a better approach is to parameterize the query or use stored procedure with parameters. That way you do not have to
> worry about SQL injection and data types can be interpreted correctly. Here is one reference:http://aspnet101.com/tutorials.aspx?id=1
>
> --
> Plamen Ratchevhttp://www.SQLStudio.com

Thank you Plamen

Jen