<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="mmres://user_interface_reference.css" rel="stylesheet" type="text/css">
<title>CFINSERT</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
   <div id="説明">
   <table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
      <tr> 
         <td valign="top" class="name">CFINSERT</td>
         <td valign="top" nowrap class="compatibility">&nbsp;</td>
      </tr>
      <tr>
         <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
      </tr>


    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">説明</span>
<p>
ColdFusion フォームまたは Form スコープ内のデータからデータソースにレコードを挿入します。 
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">カテゴリ</span>
<p>
データベース操作タグ
</p>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="syntax"><span class="title">シンタックス</span><pre>&lt;cfinsert
   dataSource = &quot;ds_name&quot;
   tableName = &quot;tbl_name&quot;
   tableOwner = &quot;owner&quot;
   tableQualifier = &quot;tbl_qualifier&quot;
   username = &quot;username&quot;
   password = &quot;password&quot;
   formFields = &quot;formfield1, formfield2, ...&quot;&gt;
</pre>    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">関連項目</span>
<p>
cfprocparam、cfprocresult、cfquery、cfqueryparam、cfstoredproc、cftransaction、cfupdate
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">ヒストリ</span>
<p>
ColdFusion&#160;MX: connectString、dbName、dbServer、dbtype、provider、および providerDSN 属性は使用禁止になりました。ColdFusion 5 以降のリリースでは、これらは機能せず、エラーを引き起こす可能性があります。
</p>

<p>

</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">例</span><pre>&lt;!--- この例は、cfquery の代わりに cfinsert を使用してデータソースにデータを挿入する方法を示してい
ます。 ---&gt;
&lt;!--- form.POSTED が存在する場合、新規レコードを挿入するために cfinsert タグを開始します。 ---&gt;
&lt;cfif IsDefined (&quot;form.posted&quot;)&gt;
   &lt;cfinsert dataSource = &quot;cfdocexamples&quot;
      tableName = &quot;Comments&quot;
      formFields = &quot;Email,FromUser,Subject,MessText,Posted&quot;&gt;
   &lt;h3&gt;&lt;i&gt;レコードがデータベースに追加されました。&lt;/i&gt;&lt;/h3&gt;
&lt;/cfif&gt;

&lt;cfif IsDefined (&quot;form.posted&quot;)&gt; 
   &lt;cfif Server.OS.Name IS &quot;Windows NT&quot;&gt; 
      &lt;cfinsert datasource=&quot;cfdocexamples&quot; tablename=&quot;Comments&quot;
         formfields=&quot;EMail,FromUser,Subject,MessText,Posted&quot;&gt; 
   &lt;cfelse&gt; 
      &lt;cfinsert datasource=&quot;cfdocexamples&quot; tablename=&quot;Comments&quot;
         formfields=&quot;CommentID,EMail,FromUser,Subject,MessText,Posted&quot;&gt; 
   &lt;/cfif&gt; 
   &lt;h3&gt;&lt;i&gt;レコードがデータベースに追加されました。&lt;/i&gt;&lt;/h3&gt; &lt;/cfif&gt;

&lt;!--- クエリーを使用して、データベースの現在のステートを表示します。 ---&gt;
&lt;cfquery name = &quot;GetComments&quot; dataSource = &quot;cfdocexamples&quot;&gt;
   SELECT
      CommentID, EMail, FromUser, Subject, CommtType, MessText, Posted, Processed
   FROM
      Comments
&lt;/cfquery&gt;

&lt;html&gt;
&lt;head&gt;&lt;/head&gt;
&lt;h3&gt;cfinsert の例&lt;/h3&gt;
&lt;p&gt;まず、cfdocexamples データソース内にあるコメントのリストを表示します。
&lt;!--- データベース内のすべてのコメントを表示 ---&gt;
&lt;table&gt;
   &lt;tr&gt;
      &lt;td&gt;送信ユーザー&lt;/td&gt;&lt;td&gt;題名&lt;/td&gt;&lt;td&gt;コメントタイプ&lt;/td&gt;
      &lt;td&gt;メッセージ&lt;/td&gt;&lt;td&gt;送信日&lt;/td&gt;
   &lt;/tr&gt;
   &lt;cfoutput query = &quot;GetComments&quot;&gt;
      &lt;tr&gt;
         &lt;td valign = top&gt;&lt;a href = &quot;mailto:#Email#&quot;&gt;#FromUser#&lt;/A&gt;&lt;/td&gt;
         &lt;td valign = top&gt;#Subject#&lt;/td&gt;
         &lt;td valign = top&gt;#CommtType#&lt;/td&gt;
         &lt;td valign = top&gt;&lt;font size = &quot;-2&quot;&gt;#Left(MessText, 125)#&lt;/font&gt;&lt;/td&gt;
         &lt;td valign = top&gt;#Posted#&lt;/td&gt;
      &lt;/tr&gt;
   &lt;/cfoutput&gt;
&lt;/table&gt;
&lt;p&gt;次に、コメントを入力する機会を提供します。
&lt;!--- 入力のためのフォームを作成 ---&gt;
&lt;form action = &quot;cfinsert.cfm&quot; method = &quot;post&quot;&gt;
   &lt;pre&gt;
   電子メール :     &lt;input type = &quot;Text&quot; name = &quot;email&quot;&gt;
   送信元 :    &lt;input type = &quot;Text&quot; name = &quot;fromUser&quot;&gt;
   題名 : &lt;input type = &quot;Text&quot; name = &quot;subject&quot;&gt;
   メッセージ : &lt;textarea name = &quot;MessText&quot; COLS = &quot;40&quot; ROWS = &quot;6&quot;&gt;&lt;/textarea&gt;
   送信日 :    &lt;cfoutput&gt;#DateFormat(Now())#&lt;/cfoutput&gt;
   &lt;!--- 今日の日付をダイナミックに判断 ---&gt;
   &lt;input type = &quot;hidden&quot;
      name = &quot;posted&quot; value = &quot;&lt;cfoutput&gt;#Now()#&lt;/cfoutput&gt;&quot;&gt;
   &lt;/pre&gt;
   &lt;input type = &quot;Submit&quot;
      name = &quot;&quot; value = &quot;コメントを挿入&quot;&gt;
&lt;/form&gt;
</pre>
         </td>
      </tr>
   </table>
   </div>
<div id="DATASOURCE">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">DATASOURCE</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">必須</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>テーブルが含まれているデータソースです。</p>

  </td>
  </tr>
  </table>
</div>
<div id="TABLENAME">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">TABLENAME</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">必須</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>フォームフィールドを挿入するテーブルです。</p>
<p>ORACLE ドライバの場合 : 大文字で指定する必要があります。</p>
<p>Sybase ドライバの場合 : 大文字と小文字が区別されます。テーブルの作成時に使用した名前と大文字小文字を同じにする必要があります。</p>

  </td>
  </tr>
  </table>
</div>
<div id="TABLEOWNER">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">TABLEOWNER</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">オプション</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>テーブル所有権をサポートしているデータソース (SQL Server、Oracle、Sybase SQL Anywhere など) の場合は、このフィールドを使用してテーブルの所有者を指定します。</p>

  </td>
  </tr>
  </table>
</div>
<div id="TABLEQUALIFIER">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">TABLEQUALIFIER</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">オプション</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>テーブル修飾子をサポートしているデータソースの場合は、このフィールドを使用してテーブルの修飾子を指定します。テーブル修飾子の内容は、ドライバによって異なります。SQL Server および Oracle の場合、修飾子は、テーブルが含まれているデータベースの名前を表します。Intersolv dBASE ドライバの場合、修飾子は DBF ファイルが置かれているディレクトリを表します。</p>

  </td>
  </tr>
  </table>
</div>
<div id="USERNAME">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">USERNAME</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">オプション</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>ODBC セットアップ内で指定されているユーザー名よりも優先されます。</p>

  </td>
  </tr>
  </table>
</div>
<div id="PASSWORD">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">PASSWORD</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">オプション</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>ODBC セットアップ内で指定されているパスワードよりも優先されます。</p>

  </td>
  </tr>
  </table>
</div>
<div id="FORMFIELDS">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">FORMFIELDS</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">オプション</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">

<strong>Default value:</strong> "(キーを除くフォーム上の全フィールド)"


<p>挿入するフォームフィールドのカンマ区切りリストです。指定しない場合は、フォーム内のすべてのフィールドが対象となります。</p>
<p>フォームフィールドがデータベース内の列名と一致しない場合は、エラーが発生します。 </p>
<p>データベーステーブルのキーフィールドがフォームに存在している必要があります。キーフィールドは非表示になっている場合があります。</p>

  </td>
  </tr>
  </table>
</div>

  </body>
</html>
