all groups > macromedia flash flash remoting > march 2005 >
You're in the

macromedia flash flash remoting

group:

Writing all records in DataGrid


Writing all records in DataGrid Call Me Mad
3/16/2005 11:58:39 PM
macromedia flash flash remoting:
Is it possible to write all records in a datagrid to a database without using a
for / next loop? It seem a little combersome having to code this to step
through each record, writing them one at a time until the end is reached. What
is the point in having a multiselect Datagrid anyway?
Re: Writing all records in DataGrid derobinson
3/18/2005 5:21:31 PM
You can bind the datagrid to a dataset and send the delta packet (any
additions, deletions, or changes) back to the server. The binding takes care of
tracking the changes, so you don't have to loop through the grid.

Good luck!



Re: Writing all records in DataGrid Call Me Mad
3/19/2005 3:02:46 AM
I must be a little dense today. I am using a dataset but still can't write all
records in one operation. As a temporary solution I am using the following code
to step through each record.

myDataSet.first();
while(myDataSet.hasNext()) {
myAddRemoteConnector.trigger();
myDataSet.next();
}
I am using a coldfusion.cfc with the following:
<cffunction access="remote" name="addMyRecord" output="false">
<cfargument name="keyField1" type="string" required="yes" default="">
<cfargument name="KeyField2" type="string" required="yes" default="">
<cfargument name="Field3" type="string" required="yes" default="">
<cfargument name="Field4" type="string" required="yes" default="">
<cfquery name="addMyRecord" datasource="WebCollect">
INSERT INTO dbo.myTable
(KeyField1,KeyField2,Field3,Field4)
VALUES
'#arguments.KeyField1#', '#arguments.KeyField2#', '#arguments.Field3#',
'#arguments.Field4#')
</cfquery>
</cffunction>
Re: Writing all records in DataGrid derobinson
3/21/2005 2:24:09 AM
That's potentially a lot of calls to your server and you probably want to
minimize those. The Update Packet (basically an XML file) is much smoother.
Flash passes just the delta, just th ethings that have changed, in the data set
back to CF. You need an XML parser to accept the packet and deal with it, but
once you write it, you've got it for all your projects. Here, take a look at
this tutorial for ideas:

http://www.macromedia.com/devnet/mx/flash/articles/delta_packet.html

Hope it helps!

Re: Writing all records in DataGrid Call Me Mad
3/24/2005 4:58:56 AM
Thank you for your reply David, I really do appreciate the help. I did play
with the RDBMSProcessor about 6 months ago with some success. Unfortunately,
tonight, trying to convert the sample code to Flash Player 7 is making me crazy
:). I'll try again tomorrow and the day after that and the day after that until
I get it right.

Thanks Again.
Re: Writing all records in DataGrid Tom Coleman
3/24/2005 1:31:33 PM
I think this tutorial is a little more up-to-date (FMX2K/AS2 style):
<http://www.macromedia.com/devnet/mx/coldfusion/articles/dc_wizard.html>

HTH,
Tom


[quoted text, click to view]
AddThis Social Bookmark Button