<background> Flash Remoting .NET recognized two special types, DataSet and DataTable, and mapped these back to a client ActionScript 1.0 type registered as "RecordSet" (this class shipped with the ActionScript Flash Remoting Components).
A .NET DataTable was returned as an instance of RecordSet. A .NET DataSet is a collection of DataTables - so on the client you'd actually get an Object with potentially many RecordSets as values. The keys to the RecordSets would be the name of the DataTable - of if the table had no name then the gateway would generate one for you, starting out at Table0, Table1, etc... Remember that Flash Remoting .NET came out for Flash 6 and hence the client components were written originally in ActionScript 1.0. Here's a comment as to what the public fields of a client ActionScript RecordSet would be: // The RecordSet constructor. // // If a RecordSet object is received from a server via the AMF protocol, then // there will be a field called "serverInfo" already existing when the constructor is called // by the AMF deserializer. the fields are: // totalCount: int // columnNames: array of string // initialData: array of array of field // id: string // version: int // cursor: int // serviceName: string // // If the RecordSet is being created by the normal "new RecordSet()" call, then // "serverInfo" will not exist. A new version of these client components was released in an update to bring Flash Remoting Components up to ActionScript 2.0 for Flash MX 2004. It was essentially the same object but it moved to a package called mx.remoting.RecordSet and was written in AS2. The Object.registerClass() entry still mapped remote "RecordSet" instances to this type so that the gateway would still send back strongly typed RecordSet instances. </background> All this said, I think it will be easier for Flex users to NOT rely on Flash Remoting client component classes for .NET DataTable and DataSets. Instead, I'd suggest you copy the data from the DataSet into a data structure that you control and are more familiar with... like a simple object array: /// C# Snippet DataTable table; // Somehow you get a DataTable Object[] allRows = new Object[ table.Rows.Count ]; int r = 0; foreach (DataRow row in table.Rows) { allRows[r] = row.ItemArray; //DataRow.ItemArray is of type object[] r++; } /// End C# Snippet Note that by doing the above you aren't making the request any slower as the gateway has to do this too to serialize the data back to AMF. -----Original Message----- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Mike Anderson Sent: Friday, June 24, 2005 4:02 PM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] All potential Properties and Methods of ASObject ?? Great - thanks! So with all that said, how can I save myself time, when sending DataSets back to the server? Right now, this is the code, which I've been using: public DataSet fetchRecord(int id) { string sqlQuery = "SELECT * FROM Table WHERE ID = " + id; ... misc code ... adp.SelectCommand = cmd; DataSet ds = new DataSet(); adp.Fill(ds, "Results"); return ds; } If the ASObject is to save me time, how can I directly populate my ASObject with my "Results", if I only have the Add() Method at my disposal? If that is the case, I must first use my legacy ADO.NET Code, populate my DataSet, and then LOOP through my DataSet, with each loop kicking off the Add() Method of the ASObject - filling it up. Why would I want to do this, if I can just send my DataSet back to my Flex App? Can't I somehow do this? public ASObject fetchRecord(int id) { string sqlQuery = "SELECT * FROM Table WHERE ID = " + id; ... misc code ... adp.SelectCommand = cmd; DataSet ds = new DataSet(); adp.Fill(ds, "Results"); ASObject myASO = new ASObject(); myASO.ASType = "Name of Registered Class on the Flex Side"; myASO = ds; - or - myASO = ds.Tables[0]; (if it only accepts a Table); return myASO; } Can I do something similar to the above? If not, then I may as well keep using my native DataSets and/or DataTables. Can you all clarify this for me? Thanks in advance, Mike -----Original Message----- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Peter Farland Sent: Friday, June 24, 2005 2:00 PM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] All potential Properties and Methods of ASObject ?? FlashGateway.IO.ASObject subclasses System.Collections.Hashtable. It adds only one extra property ASType which is used to map AMF TypedObjects between the client and server as per the information registered using Object.registerClass(). Said simply, it's just the server side representation of an ActionScript Object. Using an .ASPX page as a Flash Remoting service is not the same as C# method invocation - .ASPX pages don't have method signatures or return types so a special Flash page control was created which creates a "Flash" scope that you can get access to passed in paramters from the Flash.Params array and return results using Flash.Result. The Flash.DataSource property and Flash.DataBind() function are convenience methods to extract information out of DataTable, DataView or IEnumerable DataSouces - the developer could process their own datasources and update Flash.Result themselves in the .ASPX page. Since you're not interested in using .ASPX pages then you can ignore the information on the Flash scope and just concentrate on what you're used to - which seems to be normal C# method invocation and returning objects. The Flash scope has nothing to do with ASObject. -----Original Message----- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Mike Anderson Sent: Friday, June 24, 2005 2:23 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] All potential Properties and Methods of ASObject ?? Hello All, I am using the .NET Remoting environment - exclusively using Assemblies (.dll's) Due to absolutely poor documentation, MM makes VERY poor distinctions of the Assembly method of Remoting (using the ASObject), and using "code behind" .ASPX pages which I refuse to use. It looks to me, that when using the .ASPX methods, the user has the "Flash.DataSource" and "Flash.DataBind" options. These options do not exist for the ASObject. In fact, the only things that have been documented, are "ASObject.ASType" Property, and the "ASObject.Add()" Method - in which you put a "Name/Value" pair within the Add() Method. ALSO, totally WRONG, the MM Docs say you use the "Flash.Result" Method to send the results back. Anybody who knows C#, knows that you must use the "return" Method, when sending the expected result back. So, my only hope, is for somebody on this list who's already been through all this crap, to please post, all the Properties and Methods as it relates to the ASObject. Again, this is ONLY in the context of using .NET Assemblies - not .ASPX pages, cuz they are totally unrelated. Thanks SO much for all your help, Mike -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/