4 Replies Latest reply: Mar 16, 2007 1:03 PM by semi star gazer RSS

    Invalid Data ID Error

    semi star gazer Community Member
      Hello~

      I am recieving the following error on the action page of an online form. I've never seen it before, and really don't know where to start!
        • 1. Re: Invalid Data ID Error
          paross1 Community Member
          It looks like the data type of the value for the primary key field of the database table that you attempting to insert into with cfinsert does not match what the database expects, or some such problem. I NEVER use cfinsert or cfupdate because they are notorious for mysterious errors and they tend to mask problems that would normally be easier to figure out if you were using "normal" INSERT or UPDATE queries in cfquery tags, etc., etc. I would use an explicit INSERT statement, but that's just me.

          Phil
          • 2. Re: Invalid Data ID Error
            semi star gazer Community Member
            I totally agree about the cfinsert statement, but this is an old form built by someone else, and I was trying to find a quick fix :) But, I did go ahead and change to a SQL insert statement, and now I am getting the following error:

            Error Executing Database Query.
            [Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.

            The error occurred in E:\Inetpub\wwwroot\internships\request\internrequest_process.cfm: line 110
            Called from
            E:\Inetpub\wwwroot\internships\request\internrequest_process.cfm: line 9
            Called from E:\Inetpub\wwwroot\internships\request\internrequest_process.cfm: line 1
            Called from E:\Inetpub\wwwroot\internships\request\internrequest_process.cfm: line 110
            Called from E:\Inetpub\wwwroot\internships\request\internrequest_process.cfm: line 9
            Called from E:\Inetpub\wwwroot\internships\request\internrequest_process.cfm: line 1

            108 : '#Trim(form.Signature)#',
            109 : '#Trim(form.approve)#',
            110 : '#Trim(form.notes)#'
            111 : )
            112 : </cfquery>

            SQL INSERT INTO request ( ID, FirstName, LastName, banner, email, Street, City, Zip, DayAC, DXchng, DayPhone, DayExt, cellAC, cellXchng, cellPhone, EveAC, EveXchng, EvePhone, EveExt, credits, sem, year, grad, prog, program2, hours, pract, credit_prev, PLIP, outside_co, repeat, working, type, mentor, mentor_org, mentor_phone, mentor_fax, concurrent, current_hours, needs, employer, employ_org, employ_phone2, volunteer_org, volunteer_phone, certify, Signature, approve, notes ) VALUES ( ID, 'KC', 'VanHout', '871111654', 'kcvanhout@law.du.edu', 'asdf', 'asdf', 'asdf', 'asdf', 'asd', 'asdf', 'asdf', 'asdf', 'asd', 'asdf', 'asdf', 'ads', 'asdf', 'asdf', '2', 'Spring', '2006', 'May 2005', 'Day', 'full time', 'asd', 'y', 'y', 'y', 'y', 'y', 'y', 'Business-Corporate L5002', 'asdf', 'asdf', 'asdf', 'asdf', 'asdf', 'as', 'asdf', 'asdf', 'asdf', 'asdf', 'asdf', 'asdf', 'yes', 'asdf', '', 'asdf' )

            Here is my insert statement:
            • 3. Invalid Data ID Error
              paross1 Community Member
              The value of #Trim(form.ID)# is not numeric, in fact it is literally ID (Look at the listing of your query output and it shows VALUES ( ID, 'KC', 'VanHout', .....) You will notice that the first VALUE is ID, not an actual numeric ID value (I am assuming that your ID column is numeric).

              At least now we know why your CFINSERT failed because you are setting a bogus value for form.id.

              Phil
              • 4. Re: Invalid Data ID Error
                semi star gazer Community Member
                Thanks, that was it!!!