Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default CFGrid Problem

    Hello,

    I am using Coldfusion 7.01 and am having difficulty using the cfgrid to
    perform an insert. I have a sql table that requires two fields (update_date
    and updated_by). When I try to insert a new record through the grid, I receive
    the following error:

    Error Executing Database Query.
    [Macromedia][SQLServer JDBC Driver][SQLServer]Cannot insert the value NULL
    into column 'UPDATE_DATE', table 'PSV_Diversity.dbo.tab_VENDOR_CATEGORY';
    column does not allow nulls. INSERT fails

    I've tried to catch these values before the <cfgridupdate...>, but still
    receive the error.

    Any help or insight would be greatly appreciated.

    Thanks in advance,
    wes


    wespecht Guest

  2. Similar Questions and Discussions

    1. CFGRID in ACCORDION Problem
      I am attempting to display a CFGRID on pages of an ACCORDION. The following code builds the ACCORDION pages properly but does not display the GRID....
    2. cfgrid and comma problem!
      Hello, this is my code hello cedric !! <cfgrid name="test_grid" selectmode="single"> <cfgridcolumn name="remarques" header="Transaction No">...
    3. Problem with javascript for < CFGRID>
      I have a <cfgrid> thing that used to work in Coldfusion 4.5/Win NT. HAve recently moved to Coldfusion MX 6.1/Win 2003. Now all it gives me is a...
    4. I am desperate. cfgrid populate problem
      I am preparing some intranet application. I want to hide customers CCnumber and list only last 4 digit. But I don't want this in input text. I just...
    5. onchage, CFGRID & TAB problem. CFMX7
      Hi, anyone help me. Update a cfgrid query who is inside a tab page when user select a colum in another cfgrid?? Case: The same flash form...
  3. #2

    Default Re: CFGrid Problem

    I'm not sure this appliies to cfgrid, but it does to other cfform fields using
    the
    "_Date" as the name of a field. CF will ignore those fields because the
    "_Date"
    field name notation is for validation. Try changing the DB name, and grid field
    name to "InsertDate", with no space.

    OldCFer Guest

  4. #3

    Default Re: CFGrid Problem

    Thank you. I fumbled through it and figured it out. Here is what I did:

    Since the user can make multiple changes (inserts, updates, deletions) at one
    time, the grid stores these actions in
    an array. I loop through the action array and perform any necessary actions
    before the update is performed. All works
    fine now.

    <cfif isdefined("form.gridentered") eq true>
    <cfloop index = "Counter" from = "1" to =
    #arraylen(Form.my_grid.rowstatus.action)#>
    <cfoutput>
    <!--- MAKE SURE THE USER HAS ENTERED A VALUE (REQUIRED) --->
    <cfif #form.my_grid.DESCRIPTION[Counter]# neq "">
    <!--- ON INSERT, NEED TO PROVIDE ADDITIONAL DATE (REQUIRED FIELDS) --->
    <cfif #Form.my_grid.rowstatus.action[Counter]# eq "I">
    <cfset #form.my_grid.ADD_DATE[Counter]#=#dateformat(now(), "mm/dd/yy")#>
    <cfset #form.my_grid.ADD_BY[Counter]#=#variables.AUTHUSER#>
    <cfset #form.my_grid.CHG_DATE[Counter]#=#dateformat(now(), "mm/dd/yy")#>
    <cfset #form.my_grid.CHG_BY[Counter]#=#variables.AUTHUSER#>
    <!--- ON UPDATE, NEED TO UPDATE THE DATE/WHO UPDATED FIELDS --->
    <cfelseif #Form.my_grid.rowstatus.action[Counter]# eq "U">
    <cfset #form.my_grid.CHG_DATE[Counter]#=#dateformat(now(), "mm/dd/yy")#>
    <cfset #form.my_grid.CHG_BY[Counter]#=#variables.AUTHUSER#>
    <!--- ON DELETE, DO NOT NEED TO ANYTHING --->
    <cfelseif #Form.my_grid.rowstatus.action[Counter]# eq "D">
    <!--- deletion code (if necessary) --->
    <cfelse>
    <center><b>Please insert, update or delete a record to
    continue.</b></center><br><br>
    </cfif>
    <cfelse>
    <!--- MISSING A REQUIRED FIELD ENTRY --->
    <center><b>Please provide a category description for row
    #Counter#</b></center>
    </cfif>
    </cfoutput>
    </cfloop>

    <cfgridupdate grid="my_grid" datasource="DataSourceName"
    tablename="tableName" keyonly="no">
    </cfif>


    wespecht 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