ASP and SQLServer Error for String longer than 255 chars

ASP and SQLServer Error for String longer than 255 chars

Post by BPMargoli » Wed, 16 Feb 2000 04:00:00


Check that you have SQL Server 7.0 aware ODBC drivers. Your SQL Server driver
should be at least version 3.70.

Quote:> Hi, There

> I got an error when I tried to update a record with ASP to SQL Server. The
> error message is:

> Microsoft OLE DB Provider for ODBC Drivers error '80040e21'
> [Microsoft][ODBC SQL Server Driver]String data, right truncation

> It's because I'm updating a string field longer than 255 chars. I set the
> field to either varchar(8000) or text to no avail.

> I had similar problems before with JDBC/ACCESS. Can you give me a clue how
> to workaround it?

> Thanks.

> t.h.


1. SQL/ASP and string with more than 255 chars

Hello everybody,

Well, I made some web pages (.asp pages) to be able retrieve and store
text into a Visual Fox Pro Database (v.6.0).

 - The field in wich I put my text is a memo field (VFP field that can
contain different type of data with a dynamic size)
 - The text that I'm trying to put into this memo field is written using
a TEXTAREA (HTML) element
 - To access the database I use a SQL request written in VBasic

 - The code used is the following:

 <% set OBJdbConnection = server.createObject("adodb.connection") "DSN=ATRS2"

       SQLId = Request.Form("RepId")
       SQLStatus = Request.Form("RepStatus")
       SQLTitle = Request.Form("RepTitle")
       SQLUpdatingdate = Request.Form("RepUpdatingDate")

       Dim SQLReport

       SQLReport = Request.Form("RepReport")  ' Value of the TEXTAREA
(HTML) element

       SQLReport = Replace(SQLReport,"'","''")
       SQLReport = Replace(SQLReport,Chr(13),"<BR>")  ' substitute the
       SQLReport = Replace(SQLReport,Chr(10),"<BR>")  ' substitute the

       Dim SQLUpdate

       SQLUpdate = "UPDATE atrs_issue2 SET Description = ' "& SQLReport
&" ' where id =" & SQLId &";"

       set RSCustomerList = OBJdbConnection.execute(SQLUpdate)  '
Blocked if length of SQLUpdate > 255 char


My problem is simple:

 If the number of characters contained in the TEXTAREA element that I
 access with the var : SQLReport  exceed 255 my request is blocked by
 IIS server and the error message is (but it's possible to write more
than 255 char in the TEXTAREA):

     Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

     [Microsoft][ODBC Visual FoxPro Driver]Command contains unrecognized
phrase/keyword.     ?

 I think that maybe it's a problem related to the Server Variable
environment (IIS server) maybe there is a way to specify the amount of
the data transmitted during an OBJdbConnection.execute request.

Thanks very much, have a nice day and take care Phil Nembrini.

Phil Nembrini
Ascom Transmission AG - Broadnet Division / NAE
Schwarzenburgstrasse 73, CH-3014 Bern/Liebefeld, Switzerland
Phone: +41 31 999 2198
FAX:     +41 31 999 3057

2. Multiple forms with MFC DAO

3. problema con buffer de psql

4. Master / Detail question


6. SQL/ASP and string with more than 255 char

7. SQL/ASP and string with more than 255 chars

8. Passing parameter with size >255 chars to sqlserver 6.5

9. Memo field updates longer than 255 chars