0

Ok... developing a new website using CFWHEELS framework on CF9 & MSSQL 2008 R2

Everything is working fine except that after I insert some data to the DB and request the primary key it return invalid.

At the begging I thought was a CFWHEELS bug so I created my own CFQUERY.

Here is what I have

<cfquery name="qryInsert" datasource="medriseResearch" result="qryUser">
    INSERT INTO tbl_users (userFirstname, userLastname, userAddress, userAddress2, userCity, userState, userZipcode, userCountry, userBirth, userEmail, userCellphone, userHomephone, userRace, userMarital,userGender)
    VALUES ('#Form.TXTFNAME#','#Form.TXTLNAME#','#Form.TXTADDRESS#','#Form.TXTADDRESS2#','#Form.TXTCITY#','#Form.DROPSTATES#','#Form.TXTZIPCODE#','US','#Form.TXTDOB#','#Form.TXTEMAIL#','#Form.TXTCELLPHONE#','#Form.TXTHOMEPHONE#','#Form.DROPRACE#','#Form.DROPMARITAL#','#Form.DROPGENDER#')
</cfquery>
<cfquery name="qryProfile" datasource="medriseResearch">
    INSERT INTO tbl_advanceprofiles (userId,medicalInsurance,medicalCondition,educationLevel,employeeStatus,employeeIncome)
    VALUES (#qryUser.IDENTITYCOL#,'#Form.dropHealthinsurance#','#Form.dropCondition#','#Form.dropEducation#','#Form.dropEmpstatus#','#Form.dropIncome#')
</cfquery>

The first insert works and it saves the data to my DB. But the second INSERT does not work I get an error saying that qryUser.IDENTITYCOL is invalid.

Any idea why this is happening?

4

1 回答 1

0

尝试使用内置对象函数 valid() 查看 Wheels 返回的错误。我以前用过这个来发现我的验证规则由于数据类型不匹配、截断文本等而失败。

http://cfwheels.org/docs/1-1/function/valid

于 2013-09-10T21:08:50.023 回答