Explicitly converts a value returned by a .NET method to the corresponding ColdFusion data type.
A ColdFusion data value.
Structure functions, System functions
DotNetToCFType(variable_name)
CreateObject: .NET object, cfobject: .NET object, "Converting between .NET and ColdFusion data types" in the ColdFusion Developer's Guide
ColdFusion 8: Added this function
|
Parameter |
Description |
|---|---|
| variable_name |
Name of the .NET variable to convert |
For detailed information on when and why you use this function, see "Working with complex .NET data types" in the ColdFusion Developer's Guide.
The following example creates a .NET System.Data.DataTable object and converts it to a ColdFusion query.
<!---Create a SQL Command Object--->
<cfobject action="create" name="sqlCommandObject"
class="System.Data.SqlClient.SqlCommand" type=".Net"
assembly="#assemblyList#">
<cfset sqlCommandObject.init("SELECT [ID], [FriendlyName] FROM [Batch]",
sqlConnectionObject)>
<cfset sqlDataReaderObject = sqlCommandObject.ExecuteReader()>
<cfset dataTable = createObject(".net", "System.Data.DataTable",
assemblyList)>
<!--- populate the datatable --->
<cfset dataTable.load(sqlDataReaderObject)>
<!--- convert to cfquery --->
<cfset myquery=DotNetToCFType(dataTable)>