0
好...开发使用CFWHEELS框架上CF9 & MSSQL 2008 R2ColdFusion的9和2008 R2 MSSQL
一个新的网站一切都只是工作正常我插入一些数据到数据库,并要求主键之后返回无效。
在乞讨中,我以为是CFWHEELS错误,所以我创建了自己的CFQUERY。
这里是我有什么
<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>
第一插入作品和它的数据保存到我的数据库。但第二个INSERT不起作用我得到一个错误,说qryUser.IDENTITYCOL无效。
任何想法为什么会发生这种情况?
这里的,这似乎是显示相同的行为后。你使用的是原生SQL驱动程序吗? http://www.akbarsait.com/blog/index.cfm/2008/9/14/Using-Result-attribute-in-CFQuery-to-retrieve-AutoGenerated-Key-on-Insert-in-ColdFusion-8 – squillman 2012-02-23 18:35:09
是的,我正在使用本机SQL驱动程序 – Medrise 2012-02-23 18:41:35