Professional Web Applications Themes

using a variable for text - Microsoft SQL / MS SQL Server

I have the following statement to populate a table with data from a comments box. I'm not sure how to qualify a text variable. I put a small amount of text in the comments box, no problem. But if I put a LOT of text in the box, I get an error... Can someone get me straight on this? Thanks!!! ADODB.Command error '800a0d5d' Application uses a value of the wrong type for the current operation. /custpref.asp, line 65 This is lne 65... cmdInsert.Parameters.Append cmdInsert.CreateParameter("Comments", 200, 1,16,Request.form("Comments")) Stored procedure CREATE PROCEDURE sp_CustPref ID_Customer varchar (50), Email varchar (50), FirstName varchar (50), ...

  1. #1

    Default using a variable for text

    I have the following statement to populate a table with data from a comments
    box. I'm not sure how to qualify a text variable. I put a small amount of
    text in the comments box, no problem. But if I put a LOT of text in the box,
    I get an error... Can someone get me straight on this? Thanks!!!

    ADODB.Command error '800a0d5d'
    Application uses a value of the wrong type for the current operation.
    /custpref.asp, line 65

    This is lne 65...
    cmdInsert.Parameters.Append cmdInsert.CreateParameter("Comments", 200,
    1,16,Request.form("Comments"))

    Stored procedure
    CREATE PROCEDURE sp_CustPref
    ID_Customer varchar (50),
    Email varchar (50),
    FirstName varchar (50),
    LastName varchar (50),
    Address varchar (50),
    City varchar (50),
    State varchar (50),
    Zip varchar (50),
    Phone varchar (50),
    Comments text
    AS

    INSERT INTO dbo.CustPref
    (ID_Customer, Email, FirstName, LastName, Address,
    City, State, Zip, Phone, Comments)
    VALUES (ID_Customer, Email, FirstName, LastName, Address, City,
    State, Zip, Phone, Comments)
    GO


    shank Guest

  2. #2

    Default Re: using a variable for text

    Try 201 or 202. 200 is adVarChar, which is limited to 8000 characters.




    "shank" <rr.com> wrote in message
    news:#phx.gbl... 
    comments 
    box, 


    Aaron Guest

  3. #3

    Default Re: using a variable for text

    Thanks but neither 201 or 202 worked. Same error message. Where can I find a
    reference to this figures?
    Is this the correct use of the text variable: Comments text ?
    thanks

    "Aaron Bertrand - MVP" <com> wrote in message
    news:phx.gbl... 
    > comments [/ref]
    of 
    > box, [/ref]
    City, 
    >
    >[/ref]


    shank Guest

  4. #4

    Default Re: using a variable for text

    also, pass (-1) for Size param of Append method.

    HTH,
    </wqw>

    "shank" <rr.com> wrote in message
    news:#phx.gbl... 
    comments 
    box, 


    Vlad Guest

Similar Threads

  1. Replies: 2
    Last Post: November 29th, 05:43 AM
  2. How to put a variable value into a text file
    By Stuart Clemons in forum PERL Beginners
    Replies: 12
    Last Post: February 1st, 01:23 PM
  3. load text into variable
    By Edwin Merced in forum Macromedia Flash Actionscript
    Replies: 3
    Last Post: January 24th, 01:39 PM
  4. Dynamic Text Variable
    By kkinnebrew webforumsuser@macromedia.com in forum Macromedia Flash Actionscript
    Replies: 0
    Last Post: January 17th, 08:50 PM
  5. adding text to variable
    By J. in forum PHP Development
    Replies: 0
    Last Post: October 16th, 01:16 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not 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