Apparently the Fox ODBC driver can not update strings longer than 255 
characters in memo fields with the standard SQL UPDATE or INSERT commands 
(works fine in Access).

The workaround is to break the long string into 254 chunks and loop through 
the chunks while doing an insert or update. Microsoft Knowledge base 
Article Q208208 provides ASP code (shown below) for accomplishing this 
using the AppendChunk method. It uses ADO to add a new record, then place 
data in and ID character field and a set of 254 character strings into a 
memo field.

My problem is I haven't even cracked open the door on ASP yet, so am a bit 
clueless how to convert.

Wondering if you know of anybody/anywhere who has converted this ASP code 
to CF code or has  done something equivalent in CF?
     ^
    / \__
   (    @\___
  /          O
 /    (_____/
/_____/

Whoof...
Arden O. Weiss

***************************************************************

<%@ Language=VBScript %>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>

<%

Set oConn = Server.CreateObject("ADODB.connection")

ConnStr= "Driver=Microsoft Visual FoxPro Driver; " + _
"SourceType=DBf;SourceDB=e:\vfpdata;BackgroundFetch=No;"

oConn.Open ConnStr

'Has to be a serverside cursor.

set RS = server.CREATEOBJECT("ADOR.Recordset")
Rs.cursortype     = 1 'adOpenKeyset
Rs.cursorlocation = 2 'adUseServer
Rs.locktype       = 3 'adLockOptimistic

Rs.OPEN "select * from memotest",oConn

'Build a long string and limited appendchunk size to 254 per batch

lcLongParm = string(254,"A") + string(254, "B") + string(254,"C")
liChunkSize = 254

Rs.AddNew

'Assign the first field

rs.Fields("ID")="0001"

'Looping through 254 characters at a time and add the data
'to Ado Field buffer

FOR i = 1 to len(lcLongParm) step liChunkSize
   liStartAt = i
   liWorkString = mid(lcLongParm, liStartAt, liChunkSize)
   Rs.Fields("Memo1").AppendChunk(liWorkString)
NEXT

'Update the recordset

Rs.UPDATE

Response.Write "<table border=1 cellpadding=4>"
Response.Write "<tr>"

  For I = 0 To RS.Fields.Count - 1
     Response.Write "<td><b>" & RS(I).Name & "</b></td>"
  Next

Response.Write "</tr>"

RS.Requery

  Do While Not RS.EOF
    Response.Write "<tr>"
    For I = 0 To RS.Fields.Count - 1
       Response.Write "<td>" & cstr(RS(I)) & "</td>"
    Next

    Response.Write "</tr>"
    RS.MoveNext
  Loop

 Response.Write "</table>"
 rs.Close
 oconn.Close
 set oconn = nothing
 set rs = nothing
 %>
 </BODY>
 </HTML>

***************************************************************



Arden Weiss
410-757-3487


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to