dbTalk Databases Forums  

Updating SQL Server from ASP TextArea

comp.databases.ms-sqlserver comp.databases.ms-sqlserver


Discuss Updating SQL Server from ASP TextArea in the comp.databases.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
ContainsCaffeine
 
Posts: n/a

Default Updating SQL Server from ASP TextArea - 03-07-2010 , 10:23 PM






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

Reply With Quote
  #2  
Old   
Plamen Ratchev
 
Posts: n/a

Default Re: Updating SQL Server from ASP TextArea - 03-08-2010 , 09:54 AM






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

Reply With Quote
  #3  
Old   
ContainsCaffeine
 
Posts: n/a

Default Re: Updating SQL Server from ASP TextArea - 03-08-2010 , 04:23 PM



On Mar 9, 12:54*am, Plamen Ratchev <Pla... (AT) SQLStudio (DOT) com> wrote:
Quote:
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

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.