Whatever message this page gives is out now! Go check it out!

DotNetToCFType

Last update:
May 18, 2026

Description

Explicitly converts a value returned by a .NET method to the corresponding ColdFusion data type.

Returns

A ColdFusion data value.

Category

Function syntax

DotNetToCFType(variableName)

See also

Converting between .NET and ColdFusion data types in  Using .NET classes  in the Developing ColdFusion Applications

History

ColdFusion (2018 release): Changed parameter name value to variableName.
ColdFusion 8: Added this function

Parameters

ParameterDescription
variableName
Name of the .NET variable to convert

Usage

For detailed information on when and why you use this function, see Working with complex .NET data types in  Using .NET classes  in the Developing ColdFusion Applications.

Example

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)>

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page