Dim selectContactData As String
'insert Flash parameter into SQL statement
selectContactData = "SELECT ContactName, City, Phone FROM Customers WHERE
Country = \'" + selectedCountryName + "\'"
End If
'create the data adapter object
Dim countryAdapter As System.Data.OleDb.OleDbDataAdapter
'create a dataset object
countryAdapter = New System.Data.OleDb.OleDbDataAdapter(selectAll,
sqlConnection)
'fill the dataset with the query results
countryAdapter.Fill(contactData, "Customers")
'assign the dataset into the flash.datasource property
Flash.DataSource = contactData.Tables("Customers")
'bind the datatable to the custom server control
Flash.DataBind()
'close the SQL connection
sqlConnection.Close()
End Sub
In the code, the
the
contactData
DataSet object is bound to the Flash Remoting custom server control using the
method and returned to Flash.
Displaying a RecordSet object in Flash with ActionScript
To display a RecordSet object in a Flash UI component, you can use the DataGlue ActionScript
class, which is installed with the Flash Remoting libraries.
You can use the
Flash UI component, such as a ComboBox or a ListBox component. The following example
binds the
re.result
DataGlue.bindFormatStrings(displayNames, re.result, "#ContactName#",
"#customerID#");
In the code, the last two arguments passed to the function (
are column names in the record set. The
whereas the
customerID
component.
The following ActionScript code connects to an ASPX page, returns a RecordSet object, and
displays the record set in the
import mx.remoting.Service;
import mx.remoting.RecordSet;
import mx.remoting.DataGlue;
import mx.rpc.ResultEvent;
DataSet object is created from a SQL query to a database. Next,
contactData
DataSet object is assigned into the
DataGlue.bindFormatStrings
RecordSet object to the
column is returned when a user selects a particular record in the
displayNames
Flash.DataSource
function to display the RecordSet object in a
displayNames
#ContactName#
column is displayed in the UI component,
ContactName
ComboBox component:
Displaying a RecordSet object in Flash with ActionScript
property. Finally, the
Flash.DataBind
ListBox component:
and
#customerID#
)
155
Need help?
Do you have a question about the FLASH REMOTING MX-USING FLASH REMOTING FOR FLASH MX 2004 ACTIONSCRIPT 2.0 and is the answer not in the manual?