Add Comment
CF8 Accessing .NET DLLs Tutorial
ColdFusion Tutorial #11
This tutorial provides an example of Coldfusion 8 and .net integration.
demo.cfm
This page contains the form for the Math example and the button for the Query example.This Template is just the entry form for the action page, this page contains the two text boxes one for a number and another one a another number.
Clicking the Calculate Button the action will execute the .net method selected from the dropdown list.
Clicking the DB Example Button the .Net method will be executed that will fetch the data from the Access databsae.
cfsampleaction.cfm
This is the action page that calls the .NET methods from the dll.To access the .net methods first we need to create an object for the .Net Class , after creating the object we can access the methods in that class .
Following is a sample code snippet for accessing the .net methods from coldfusion.
cfsample.cs
This is the C# code for the DLL. The compiled DLL and Access DB used is available in the download.Below are the steps to run this example locally
1. Copy the Access MDB file into a directory, you need to specify this directory in the CfSample.cs class file.
2. Create the .Net Class Library in Visual studio 2005 by changing the path in the CfSample.dll class file.
3. Compile the Visual studio solution which will create the DLL
4. Copy the generated DLL file into the folder with the ColdFusion code
5. Call the .NET methods from ColdFusion as described above.
Demo
See this code running!
Download
Download this code as a zip!
Comments
Do you know if this can be done with a VB.NET assembly, and do you know of, or have any examples of the VB.NET code that will work for that? Thanks for the excellent tutorial.Steve Palmer @ Friday 28 Sep 2007 - 04:14:02 AM
Hi
YEs it can be done using vb.net , If you want
i can send the samples on VB.net too
Send me your email id to my id so that i can send the
samples to u .
My email id is wrvishnu(at)(gmail)(dot)(com)
Vishnuprasad @ Friday 28 Sep 2007 - 08:28:19 PM
Click button to add a comment
Author
Vishnu Prasad
Published
Thursday 27 Sep 2007Original
This tutorial has been modified and published with permission of the author. The original tutorial can be found herehttp://wrvishnu.wordpress.com/2007/09/12/coldfusion-net-integeration/