Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to put long string in VFP memo field thru ADO?
Message
General information
Forum:
Visual FoxPro
Category:
Internet applications
Miscellaneous
Thread ID:
00543755
Message ID:
00544955
Views:
17
I put this rs.AddNew / rs.Update method into the .ASP and it works great! Actually, it works without breaking the text string up and using AppendChunk() method. I used the rs.Update to edit an existing record and that works great too.
For anyone reading this, refer below to J.'s reference to MSKB article for good example code. IMO, you can ignore the for...next loop and the AppendChunk() method in it.
Thanks for all your help, J. and David !!

>You will be on the same AddNew record when you update. Its exactly the same as if you did APPEND BLANK and REPLACE in FoxPro.
>
>When you use rs.Addnew, rs("field") = value, rs.Update, behind the scenes ADO is creating a SQL insert statement. The SQL insert will be executed (sent to the backend) when you do the rs.Update. After the update, any auto incremented or default values should be available. i.e.
>
>rs.Update
>id=rs.fields("PrimaryKey").Value

I looked at the rs.fields("PrimaryKey").Value after the rs.Update as shown above, but it comes back blank. So far we don't have to have that, but it would be great to be able to get that key value, then create child records in another table using it as the foreign key.
Oh well, that's another day...

>
>HTH
>
>-Dave
>
>>We're using sql="insert..." and conn.Execute sql. This creates a key field value by using the key field's default call to a stored proc. So it seems to be multiuser safe.
>>The rub is, if I had to retrieve that record in ASP, I can't since its key is generated by VFP on the back-end, and is not known to the ASP script. If another user inserts a record before I execute "select Max(id)...", I would get his record instead.
>>The good news is that we don't have to retrieve the record to finish it since the whole record is inserted at once, and doesn't require an update to put in some of the fields.
>>Referring to the MSKB sample you mentioned, it seems to require rs.AddNew and rs.Update. Is the Update guarranteed to occur on the record created by AddNew? Or do I need to find a way to select the record I just added in order to perform the update?
>>This may be more an ASP/ADO question, except that VFP's ODBC seems to require a work-around to save large strings to a memo field.
>>
>>
>>
>>>If you have text on this memo field and it's not unwieldly big ADO should be able to handle it with one of the varchar data types. If it's big then you might need the GetChunck method or even the ADO Stream object.
>>>
>>>If you need a VFP cursor, (and your field is not too big) you can use a utility I posted to the UT downloads: http://www.levelextreme.com/wconnect/wc.dll?FournierTransformation~2,54,Forum=5,28,1454 . It's a recordset to cursor conversion utility based on ADO's GetRows method.
>>>HTH
>>>
>>>>Thanks, that article is the right "on target".
>>>>The next question is, will there be a problem getting the whole memo field back for display in the browser? I'm going to try that out this morning, if I can get the MSKB sample to work.
>>>>Thanks again!
>>>>
>>>>>>Hi All,
>>>>>>We are developing ASP using ADO connection to VFP backend DBC. We need to be able to SQL-insert long ( >255 chars) strings into VFP table's memo field. Saw thread #531549 and updated to SP5, but that didn't fix our problem. The insert still fails and throws an error. Does anyone know what we're missing? How is this supposed to work?
>>>>>>TIA
>>>>>>Bill Simpson
>>>>>
>>>>>This MSKB might be of help: http://support.microsoft.com/support/kb/articles/Q208/2/08.ASP
>>>>>HTH
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform