Saving a TEXTAREA to a "TEXT" field using ASP

Results 1 to 10 of 10

Thread: Saving a TEXTAREA to a "TEXT" field using ASP

  1. #1
    Join Date
    Dec 1969
    Posts
    6

    Default Saving a TEXTAREA to a "TEXT" field using ASP

    I have a TEXTAREA that needs to be saved to a "TEXT" field in a SQLServer 2000 DB. If I try to submit a small amount of data, the form posts fine. However, when I try to POST the form and the input is large, the page doesn&#039;t submit.<BR><BR>I&#039;m not sure if it&#039;s a MDAC limitation or ASP limitation or problem. <BR><BR>Using:<BR>Windows 2K/IIS<BR>IE 5.5<BR>MDAC 2.6<BR>ASP<BR>SQLServer2000<BR><BR>I looked throught the FAQs etc, but didn&#039;t find anyone saving a lot of text in a TEXTAREA w/the TEXT attribute in SQLServer 2000.<BR><BR>Thanks in advance.<BR>

  2. #2
    Join Date
    Dec 1969
    Posts
    96,118

    Default So what is the error?

    Or is there one?<BR><BR>You say the form doesn&#039;t submit. What does that mean? Do you mean it doesn&#039;t even reach the page that processes the form? What do you see if you do <BR>Response.Write "&#060;PRE&#062;" & Request("theProblemField") & "&#060;/PRE&#062;"<BR>???<BR><BR>How much is "small amount of data"?<BR><BR>How are you trying to store it into the DB? If it has line breaks and you are building a SQL INSERT, how are you handling them?<BR><BR>By now I hope you get the point: You&#039;ve asked such a very vague question that it&#039;s really impossible to diagnose with no more info than you&#039;ve given.<BR><BR>At least I can&#039;t.<BR><BR>

  3. #3
    Join Date
    Dec 1969
    Posts
    6

    Default RE: So what is the error?

    I guess I was looking for someone who has actually submitted a large TEXTAREA field (in HTML) to a SQLServer DB (TEXT) field. <BR><BR>When I say large area, it&#039;s more in the realm of 2000 chearacters w/carriage returns.<BR><BR>Thanks for the input (i think).<BR><BR>

  4. #4
    Join Date
    Dec 1969
    Posts
    549

    Default Why/how do you expect anyone to help you?

    When you don&#039;t answer perfectly reasonable questions. If we don&#039;t understand the nature of the problem how can we help? How can it be anything to do with MDAC or ASP if the form doesn&#039;t submit?<BR><BR>Go work it out yourself.


  5. #5
    Join Date
    Dec 1969
    Posts
    20

    Default RE: So what is the error?

    Assuming that it is a line break or quote character causing your problem:<BR>You need to use the Replace function to search through your text field and:<BR>1) replace vbCrLf with &ltbr&gt<BR>2) replace any single quotes with two single quotes or with &amp;#146;<BR>3) as an extra, if there are any matched double quotes replace them with &amp;#147;(the quoted text)&amp;#148;<BR><BR>something along the lines of:<BR>myString = Request.Form("textareaname")<BR>newString = Replace(myString,vbCrLf,"&ltbr&gt")<BR><BR>Persona lly, I prefer to use client side JavaScript to validate form entries, and hence would use JavaScript to replace the offending characters before my ASP page has to deal with them.

  6. #6
    Join Date
    Dec 1969
    Posts
    6

    Default RE: So what is the error?

    Hanszon - Thanks!!!<BR>

  7. #7
    Join Date
    Dec 1969
    Posts
    6

    Default RE: Why/how do you expect anyone to help you?

    Thinking it was the way the question was answered, not the answer.<BR><BR>Thanks, I did. I&#039;ve also helped several people here over the years ... I guess it&#039;s just a matter of "style".<BR><BR>Thanks, and have a nice day.

  8. #8
    Join Date
    Dec 1969
    Posts
    549

    Default I know where you're coming from...

    ...but some people spend a lot of time here helping people and I imagine that it gets very frustrating when people want answers but fail to even describe the basics of the problem.

  9. #9
    Join Date
    Dec 1969
    Posts
    6

    Default RE: I know where you're coming from...

    Ok, uncle u guys win the pissing contest.<BR><BR>I was just asking for information in general about posting large (lets just say 1 MB) text areas and posting to SQLServer2000 text form.<BR><BR>Thanks anyway.

  10. #10
    Join Date
    Dec 1969
    Posts
    96,118

    Default And I *disagree* with that answer...

    If that is all you were asking, why didn&#039;t you come out and SAY SO!<BR><BR>Sigh.<BR><BR>Anyway... Yeah, that *will* get the data into the DB. But the data won&#039;t be in the original format and it&#039;s a pain in the neck.<BR><BR>It&#039;s why I asked if you were doing a SQL INSERT or not. If you were, I was going to suggest trying the ADO method of adding/updating records:<BR><BR>&#060;%<BR>...<BR>RS.Open "tablename", conn, adOpenKeyset, adLockOptimistic<BR>RS.AddNew<BR>RS("whatever") = Request("whatever")<BR>RS("bigTextField") = Request("bigTextField")<BR>...<BR>RS.Update<BR>... <BR>%&#062;<BR><BR>See if that doesn&#039;t work even if you don&#039;t modify the data from the form one iota.<BR><BR>*Now* do you see the point of my questions???<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
  •