Inserts records in data sources from data in a ColdFusion form or form Scope.
<cfinsert dataSource = "ds_name" tableName = "tbl_name" tableOwner = "owner" tableQualifier = "tbl_qualifier" username = "username" password = "password" formFields = "formfield1, formfield2, ...">
   cfprocparam, cfprocresult, cfquery, cfqueryparam, cfstoredproc, cftransaction, cfupdate
   New in ColdFusion MX: the connectString, dbName, dbServer, dbtype, provider and providerDSN attributes are deprecated. Do not use them. They do not work, and might cause an error, in releases later than ColdFusion 5. 
<!--- This shows how to use cfinsert instead of cfquery to put 
data in a datasource. --->
<!--- if form.POSTED exists, we insert new record, so begin cfinsert tag --->
<cfif IsDefined ("form.posted")>
  <cfinsert dataSource = "cfsnippets"
    tableName = "Comments"
    formFields = "Email,FromUser,Subject,MessText,Posted">
  <h3><I>Your record was added to the database.</i></h3>
</cfif>
<cfif IsDefined ("form.posted")> 
  <cfif Server.OS.Name IS "Windows NT"> 
    <cfinsert datasource="cfsnippets" tablename="Comments"
      formfields="EMail,FromUser,Subject,MessText,Posted"> 
  <cfelse> 
    <cfinsert datasource="cfsnippets" tablename="Comments"
      formfields="CommentID,EMail,FromUser,Subject,MessText,Posted"> 
  </cfif> 
  <h3><i>Your record was added to the database.</i></h3> </cfif> 
<!--- use a query to show the existing state of the database --->
<cfquery name = "GetComments" dataSource = "cfsnippets">
  SELECT 
    CommentID, EMail, FromUser, Subject, CommtType, MessText, Posted, Processed
  FROM 
    Comments
</cfquery>
<html>
<head></head>
<h3>cfinsert Example</h3>
<p>First, show a list of the comments in the cfsnippets datasource.
<!--- show all the comments in the db --->
<table>
  <tr>
    <td>From User</td><td>Subject</td><td>Comment Type</td>
    <td>Message</td><td>Date Posted</td>
  </tr>
  <cfoutput query = "GetComments">
    <tr>
      <td valign = top><a href = "mailto:#Email#">#FromUser#</A></td>
      <td valign = top>#Subject#</td>
      <td valign = top>#CommtType#</td>
      <td valign = top><font size = "-2">#Left(MessText, 125)#</font></td>
      <td valign = top>#Posted#</td>
    </tr>
  </cfoutput>
</table>
<p>Next, we'll offer the opportunity to enter a comment:
<!--- make a form for input --->
<form action = "cfinsert.cfm" method = "post">
  <pre>
  Email:   <input type = "Text" name = "email">
  From:   <input type = "Text" name = "fromUser">
  Subject:<input type = "Text" name = "subject">
  Message:<textarea name = "MessText" COLS = "40" ROWS = "6"></textarea>
  Date Posted:   <cfoutput>#DateFormat(Now())#</cfoutput>
  <!--- dynamically determine today's date --->
  <input type = "hidden" 
    name = "posted" value = "<cfoutput>#Now()#</cfoutput>">
  </pre>
  <input type = "Submit" 
    name = "" value = "insert my comment">
</form>