SQL error '80040e21' when adding more text than the Field can handle

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default SQL error '80040e21' when adding more text than the Field can handle

    I have a field in a table called description. I set the lenght to
    7000 characters and the datatype to char on the description field.
    Problem is that some people are putting more than 7000 characters into
    the description field and are getting the error below. How can I
    resolve this?



    ERROR BELOW:

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

    Multiple-step OLE DB operation generated errors. Check each OLE DB
    status value, if available. No work was done.

    /kb/kb/submitadd.asp, line 80
    Arnaldo Cabral Guest

  2. Similar Questions and Discussions

    1. Adding Text to a PDF Doc. [Compiler Error]using PDETextAdd () Method
      Hi, I'm trying to add some text to a PDF using the PDETextAdd() Method, but for some reason it doesn't recognize the first four parameters... ...
    2. adding servlet-mapping to handle any request
      Is there a wildcard that i can add to the web.xml file in the servlet-mapping section so coldfusion mx will handle all requests that are passed to...
    3. Login User User Error 80040e21
      I am getting an 80040e21 error using the log in user server behavior. The complete error message is Microsoft OLE DB Provider for SQL Server...
    4. Adding text to dynamic text field
      When loading text from an external text file into a dynamic text field using the following Action Script: Features_lv = new LoadVars();...
    5. Error 80040e21 - Received when setting a new record's values
      I am opening a connection to my Table via the recordset object. I have poured over it, but i can't seem to find the issue. I consistently...
  3. #2

    Default Re: SQL error '80040e21' when adding more text than the Field can handle

    >I have a field in a table called description. I set the lenght to
    > 7000 characters and the datatype to char on the description field.
    > Problem is that some people are putting more than 7000 characters into
    > the description field and are getting the error below. How can I
    > resolve this?
    Before you send it to the database, trim it to 7000 characters. You can do
    this in VBScript/ASP by saying:

    sql = "INSERT ... VALUES('" & left(var, 7000) & "')"

    Instead of:

    sql = "INSERT ... VALUES('" & var & "')"

    You should also consider handling this validation on the client side
    beforehand, so users aren't surprised when their content was silently
    trimmed on them.

    BTW, datatype should be VARCHAR, not CHAR. Unless everyone is expected to
    enter *exactly* 7000 characters.
    [url]http://www.aspfaq.com/2354[/url]

    I'd also be interested in the code (both ASP and SQL) that causes this
    error. What you *should* have received is:

    Server: Msg 8152, Level 16, State 9, Line 1
    String or binary data would be truncated.
    The statement has been terminated.

    Which would translate in ASP as:

    Microsoft OLE DB Provider for SQL Server error '80040e57'
    String or binary data would be truncated.

    See [url]http://www.aspfaq.com/2289[/url] for more information.

    --
    Aaron Bertrand
    SQL Server MVP
    [url]http://www.aspfaq.com/[/url]



    Aaron Bertrand [MVP] Guest

  4. #3

    Default Re: SQL error '80040e21' when adding more text than the Field can handle

    Function TextIn(theText, theMaxLength)
    Dim sResult
    sResult = theText
    If Len(sResult) > theMaxLength Then sResult = Left(sResult,
    theMaxLength)
    sResult = "'" & Replace(sResult, "'", "''") & "'"
    End Function


    sValue = Request.Form("textfield")
    sSQL = "EXEC YourProcedure " & TextIn(sValue,7000)

    Ray at work

    "Arnaldo Cabral" <wwwacny@yahoo.com> wrote in message
    news:63108917.0404130911.60dec2c0@posting.google.c om...
    > I have a field in a table called description. I set the lenght to
    > 7000 characters and the datatype to char on the description field.
    > Problem is that some people are putting more than 7000 characters into
    > the description field and are getting the error below. How can I
    > resolve this?
    >
    >
    >
    > ERROR BELOW:
    >
    > Microsoft OLE DB Provider for ODBC Drivers error '80040e21'
    >
    > Multiple-step OLE DB operation generated errors. Check each OLE DB
    > status value, if available. No work was done.
    >
    > /kb/kb/submitadd.asp, line 80

    Ray at Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139