Technical Tips and Solutions

Back to Tech Tips

16/01/2003 - Inserting large text blocks from web forms

There is a limit of 255 characters to the length of a SQL insert string. This limits SQL as a means of inserting large blocks of text, such as this field. The solution is to use ADO. The code for procession this form is:

<%

cnString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & server.mappath("/db/tips2k.mdb")

Set RS = Server.CreateObject("ADODB.Recordset")

RS.Open "Tips", cnstring, adopenstatic,adlockoptimistic

RS.AddNew

RS("Subject") = request.Form("txtSubject")

RS("Body") = request.Form("txtBody")

RS("Date") = request.Form("txtDate")

RS.Update

RS.Close

set rs=nothing

%>

Back to Tech Tips