You get same error without the setName aspect:
<cfscript>
local.qryObj = new Query(datasource="PNGOasis");
local.qryObj.setSQL("
INSERT INTO PNGOasisExt.dbo.Test(testValue) VALUES ('test value')
");
local.qryObj.execute();
</cfscript>Error: 11:01:30.030 - Expression Exception - in C:/ColdFusion9/CustomTags/com/adobe/coldfusion/base.cfc : line 460 Cannot find qryname19596 key in structure. On Mon, Oct 14, 2013 at 7:49 AM, Nando <[email protected]> wrote: > > I don't use setName() in my script based queries and it works. If I need a > result back from the query, then I use a different variable name > (v.perviousPayPeriod) from the one I use to construct and execute the query > (v.payPerQ). Here's an example of some working code: > > v.payPerQ = new Query(); > v.payPerQ.setSql(" > select paymentPeriodId > from PaymentPeriod > where startDateTime = :startDateTime > and endDateTime = :endDateTime > and isClosed = 1 > "); > v.payPerQ.addParam( name='startDateTime', > value='#v.previousStartDateTime#', cfsqltype='cf_sql_timestamp' ); > v.payPerQ.addParam( name='endDateTime', value='#v.previousEndDateTime#', > cfsqltype='cf_sql_timestamp' ); > v.previousPayPeriod= v.payPerQ.execute().getResult(); > if (v.previousPayPeriod.RecordCount) { > ... do something > } else { > ... do something else > } > > > > > > On Mon, Oct 14, 2013 at 12:44 PM, Raymond Camden <[email protected] > >wrote: > > > > > Two things. > > > > 1) Don't forget that the code behind the script based CFCs is not > > encrypted. You can look at base.cfc. > > > > 2) The issue seems to be this line: > > > > <cfset tagResult.setResult(StructFind(variables,tagAttributes['name']))> > > > > But - it is wrapped in a try/catch, so you shouldn't be seeing it. If you > > get rid of the setname aspect, which I don't think you need, does it work > > ok? > > > > > > > > > > On Sun, Oct 13, 2013 at 9:59 PM, Kumar Shah <[email protected]> wrote: > > > > > > > > This is the first time I am creating components wholly in cfscript. > > > > > > When running update or insert statements via the cfscript query > functions > > > an error gets recorded like: > > > 22:52:17.017 - Expression Exception - in > > > C:/ColdFusion9/CustomTags/com/adobe/coldfusion/base.cfc : line 460 > > > > > > Cannot find updSaveXML key in structure. > > > > > > > > > The system still processes fine. The query runs, data gets saved, > > > updated. I don't know why the error above gets reoorded. > > > > > > I ran a simple test with code: > > > > > > local.qryObj = new Query(datasource="PNGOasis"); > > > local.qryObj.setName("test"); > > > local.qryObj.setSQL(" > > > INSERT INTO PNGOasisExt.dbo.Test(testValue) VALUES ('test > value') > > > "); > > > local.qryObj.execute(); > > > > > > Same Error: > > > > > > 22:58:48.048 - Expression Exception - in > > > C:/ColdFusion9/CustomTags/com/adobe/coldfusion/base.cfc : line 460 > > > > > > Cannot find test key in structure. > > > > > > > > > Thanks > > > > > > > > > > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:356920 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

