Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 Problem updating a ntext field

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-08-27 : 11:30:16
Charles writes "I have a SQL2000 database running on Windows 2000 Server that has a table with several fields, including a ntext field (Notes) that is maintained using a ASP page. I have had no problems with this page until I tried to update the ntext field. When we add the ntext field to the update statement, the ASP page starts to process the script, but runs "forever" without showing any error messages. I say "forever" because it has run for over 5 minutes without ever doing anything.

I have searched your site for ntext, and read every article but ddn't find any explanation why this field can't be updated.

Here is our code:

CONN_STRING = Application("ConnectionString")

strSQLUpdate = "Select LastName, Notes from table1 Where ID = 123"

Set rstDBUpdate = Server.CreateObject("ADODB.Recordset")

rstDBUpdate.Open strSQLUpdate, CONN_STRING, adOpenKeyset, adLockOptimistic, adCmdText

rstDBUpdate.Fields("LastName") = "Void- " & rstDBUpdate.Fields("LastName")

strNotes = "This enrollment has been replaced by a new enrollment."

rstDBUpdate.Fields("Notes") = strNotes

rstDBUpdate.Update

I know, I know, "never use a ntext field" is probably the right answer, but I inherited the database, and the client already has too much text in the field to convert it to another field type. I have little choice but to get this darn field to update!

Any help would be most appreciated...

Thanks in advance!

Charles"

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2002-08-27 : 17:01:40
This is just a guess, but you may not be able to use the RS.Update technique for your ntext field. I'd suggest doing some reading in BOL on READTEXT, WRITETEXT, and UPDATETEXT to get a feel for how you might better deal with this field type.
Go to Top of Page

Onamuji
Aged Yak Warrior

504 Posts

Posted - 2002-08-27 : 18:25:27
Actually there is nothing really wrong with using binary data fields (TEXT, NTEXT, IMAGE) except they are very difficult to work with... I actually have come up with a few techniques (procedures) for working with them easily and since have started using them... no more 8000 character limits on text ...

Go to Top of Page
   

- Advertisement -