EasyCFM.COM ColdFusion Forums / ASP to CFML / The Ultimate Challange

   Reply to Discussion | New Discussion << previous || next >> 
Posted By Discussion Topic: The Ultimate Challange

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts last

ClevelandNative
02-21-2004 @ 9:24 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 5
Joined: Feb 2004

I need to be able to submit large amounts of data into my databases memo field using a web based form. I found a code that can do this but it's an ASP code. It's called AppendChuck. Is it possible to convert this to ColdFusion??? Here is the code:

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

<p>
  <%

Set oConn = Server.CreateObject("ADODB.connection")
  
ConnStr= "Driver=Microsoft Visual FoxPro Driver; " + _
"SourceType=DBf;SourceDB=websurfer\inetpub\wwwroot\Database2\christianvisions.dbc;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

%>     
</p>
<form name="form1" method="post" action="">
<table width="503" border="1">
  <!--DWLayoutTable-->
  <tr>
    <td width="124" height="23" valign="top">ID</td>
    <td width="355" valign="top"><input name="id" type="text" id="id"></td>
    <td width="2"></td>
  </tr>
  <tr>
    <td height="41" valign="top">MEMO</td>
    <td valign="top"><textarea name="memotest" cols="45" rows="10" id="memotest"></textarea></td>
    <td></td>
  </tr>
  <tr>
    <td height="23" colspan="2" align="center" valign="middle"><input type="submit" name="Submit" value="Submit"></td>
    <td></td>
  </tr>
</table>
</form>
<p>  </p>
</BODY>
</HTML>


maquiladoras
02-21-2004 @ 1:06 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 2073
Joined: Dec 2002

question,
have you actually tried doing it straight from CF?
what error do you get?
and exactly how much data is going into it?

-
"There is no justice, There is Just Us"
-

ClevelandNative
02-21-2004 @ 1:46 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 5
Joined: Feb 2004

When I submit the form with less than 255 characters, it works fine. But when I attempt to submit more than 255 characters I recieve a syntax error that reads:

Error Executing Database Query.  
[Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Visual FoxPro Driver]Command contains unrecognized phrase/keyword.


maquiladoras
02-21-2004 @ 2:07 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 2073
Joined: Dec 2002

ah right yeah
the problem is with fox pro
it'll only accept 255 chars
so you need to do

"this text" + "that text" etc
a humdinger
ill let you know when i have an answer for you Smile

-
"There is no justice, There is Just Us"
-


Website Designed and Developed by Pablo Varando.