How many char. or bits can fit into a VB or ASP va

Results 1 to 2 of 2

Thread: How many char. or bits can fit into a VB or ASP va

  1. #1
    Join Date
    Dec 1969

    Default How many char. or bits can fit into a VB or ASP va

    Hello I am making a site which involves a internal messaging system which I store in a SQL Server Database. So I will have a Sender, Recipient, Subject, and Body field. For my Body field (where the message body is contained) I am wondering how big can the variant be. I have it set in SQL server that this field will be no greater than 7000 chars. Is this too big for a variant, if so what is the limit? <BR><BR>also another quick question. For this body tag I have a &#060;textarea&#062; form tag. I have found out that I cannot put a "maxlength" property for the max number of chars like I can with a textbox. Is there a way in HTML to restrict the number of chars in this textarea.<BR><BR>Thanks alot<BR><BR>Mike M

  2. #2
    Join Date
    Dec 1969

    Default DB limit...not ASP or VBS...

    And it&#039;s not "variant";s "VarChar" or "Char Varying", the DB types.<BR><BR>The max length of a *record* in SQL Server is around 8000 bytes, roughly the same as the max for a char or varchar field. But that does *not* include "text" fields, which can be up to 2 GIGAbytes in size!<BR><BR>Look here:<BR><BR><BR>When in doubt, look it up in the docs!<BR><BR>*********************<BR><BR>No easy way to restrict the size of a textarea.<BR><BR>One trick:<BR><BR>&#060;SCRIPT&#062;<BR>function checkSize( )<BR>{<BR>&nbsp; &nbsp; ta = document.FormName.TextAreaName;<BR>&nbsp; &nbsp; if ( ta.value.length &#062; 1000 )<BR>&nbsp; &nbsp; {<BR>&nbsp; &nbsp; &nbsp; &nbsp; alert("You have entered too much into the text area!");<BR>&nbsp; &nbsp; &nbsp; &nbsp; ta.value = ta.value.substring(0,1000);<BR>&nbsp; &nbsp; }<BR>&nbsp; &nbsp; setTimeout( "checkSize( )", 1000 ); &#039; check once a second<BR>}<BR>checkSize( );<BR>&#060;/SCRIPT&#062;<BR><BR>So every second the JS code checks the size and chops it off if it&#039;s too long. If you wanted to be nice about it, you could copy the removed text to a temp spot so it could be recovered.<BR><BR>

Posting Permissions

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