Constraint Violation beans that there would be more than one records
with the same
Set of values. Check your Primary Keys and Indexes.
 

-----Original Message-----
From: Rick Faircloth [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, January 25, 2006 4:17 PM
To: CF-Talk
Subject: Can anyone spot a problem with this query?

MySQL is giving me an "ODBC Error Code = 23000 (Integrity contraint
violation) and says I have an error in my SQL syntax...I can't find
it...data being sent from form fields has been tested an appear to be in
proper form...I can't figure out why it's getting heartburn over this
query...  ???

Thanks,

Rick

<CFQUERY Name="InsertCampWeek" Datasource="#DSN#">

     Insert
       into campweeks

            (
             CampWeekName,

            <CFIF IsDate(Trim(Form.StartDate))>
             StartDate,
            </CFIF>

            <CFIF IsDate(Trim(Form.EndDate))>
             EndDate,
            </CFIF>

             DeanName,
             DeanBio,
             DeanPhoto,
             WeekDescription,
             Cost,
             Grades,

            <CFIF IsDate(Trim(Form.RegistrationStartTime))>
             RegistrationStartTime,
            </CFIF>

            <CFIF IsDate(Trim(Form.DismissalTime))>
             DismissalTime,
            </CFIF>

             SpacesAvailable
            )

     Values (
             <cfqueryparam cfsqltype="CF_SQL_VARCHAR"
Value="#Form.CampWeekName#">,

             <CFIF IsDate(Trim(Form.StartDate))>
             <cfqueryparam cfsqltype="CF_SQL_DATE"
Value="#DateFormat(CreateODBCDate(ParseDateTime(Form.StartDa
te)), 'M/D/YYYY')#">,
             </CFIF>

             <CFIF IsDate(Trim(Form.EndDate))>
             <cfqueryparam cfsqltype="CF_SQL_DATE"
Value="#DateFormat(CreateODBCDate(ParseDateTime(Form.EndDate
)), 'M/D/YYYY')#">,
             </CFIF>

             <cfqueryparam cfsqltype="CF_SQL_VARCHAR"
Value="#Form.DeanName#">,
             <cfqueryparam cfsqltype="CF_SQL_LONGVARCHAR"
Value="#Form.DeanBio#">,
             <cfqueryparam cfsqltype="CF_SQL_VARCHAR"
Value="#Form.DeanPhoto#">,
             <cfqueryparam cfsqltype="CF_SQL_LONGVARCHAR"
Value="#Form.WeekDescription#">,
             <cfqueryparam cfsqltype="CF_SQL_DOUBLE"
Value="#LSParseCurrency(Form.Cost)#">,
             <cfqueryparam cfsqltype="CF_SQL_VARCHAR"
Value="#Form.Grades#">,

             <CFIF IsDate(Form.RegistrationStartTime)>
             <cfqueryparam cfsqltype="CF_SQL_TIME"
Value="#TimeFormat(CreateODBCTime(Form.RegistrationStartTime
), 'h:mm tt')#">,
             </CFIF>

             <CFIF IsDate(Form.DismissalTime)>
             <cfqueryparam cfsqltype="CF_SQL_TIME"
Value="#TimeFormat(CreateODBCTime(Form.DismissalTime), 'h:mm tt')#">,
             </CFIF>

             <cfqueryparam cfsqltype="CF_SQL_INTEGER"
Value="#Form.SpacesAvailable#">

     </CFQUERY>





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:230446
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to