insert using cfinsert

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default insert using cfinsert

    I have been trying to upgrade my server from CF 5 to CF 7. I have a table as
    keywords with the attributes as follows:
    ID int (primary key)
    keyword char

    In form 1 the code is as follows:

    <form name="InsertKeywords" action="form2" method="post">
    <input name="keyword" type="text" maxlength="255">
    </form>

    In form 2 the code is as follows:
    <cfinsert datasource="EMP" tablename="keyword">

    As the ID is a primary key the system automatically generates a unique key and
    inserts into the DATABASE,Suppose if the database had the following:

    Metal 10
    Chalk 11

    The next keyword will have the ID as 12.It used to work earlier,now i get this
    odd error:
    [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Cannot insert the value
    NULL into column 'ID', table 'EMP.dbo.keyword'; column does not allow nulls.
    INSERT fails.

    Any help or suggestions would help.

    surenr Guest

  2. Similar Questions and Discussions

    1. a problem about cfinsert&sql.insert
      hi~ when i insert data into form,there is a stranger things happend: when i insert with one value ,it's ok,but when changing the number of the...
    2. cfinsert help
      I would like to have people insert information into a database. It's a single table in a database, so I thought I would try <cfinsert> I'm...
    3. cfinsert from javascript
      I have write javascript to create form field when button is click. function addEvent(myTable){ var lastRow = myTable.rows.length; var...
    4. CFInsert
      Hi. I was hoping I could get help on an issue. I am using CFInsert to add data from a form into two tables that are related. Table 1: Members...
    5. CFinsert misbehaves
      Any ideas why a CFinsert tag would work on my partner's desktop and not on my laptop? Both are using CF 6.0 and MS Access database. All the...
  3. #2

    Default Re: insert using cfinsert

    Double check in your database that the Identity property of your ID field is true. SQL Server won't increment just because a field is a primary key. It incremenets based on the Identity property.
    SteveBryant Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139