The problem is with the lastID. If  I do this
<cfquery datasource="#request.eltcdata#">insert into Student_Status 
(Student_ID,Status_ID) values("#lastID#","#i#")</cfquery> I get an 
error, but if I put in a value ofr lastID like this:
<cfquery datasource="#request.eltcdata#">insert into Student_Status 
(Student_ID,Status_ID) values(118,"#i#")</cfquery>
the query executes (properly).

The cfdump for my lastID looks correct in the sense that it's the right 
number, but what datatype I do not know for sure. I suspect that this 
function is wonky but I don't know enough about CF to know why it 
"works" but does not work.
Here's the method which is in the same component as the SQL inserts:
<cffunction access="private" name="getLastID" output="false" 
returntype="query">
<cfset var qlast ="">
<cfquery name="qlast" datasource="#request.eltcdata#">
select Max(Students.Student_ID) AS Expr1
from Students
</cfquery>
<cfreturn qlast>
</cffunction>

I have tried different returntypes which throw an error, e.g.:


  The value returned from function getLastID() is not of type numeric.




Dominic Watson wrote:
>> Okay..this is interesting. The statement (and a couple punctuation
>> variations with/without quotes/semicolon, etc):
>> <cfoutput>insert into Student_Status (Student_ID,Status_ID)
>> values(#lastID#,#i#);</cfoutput>
>>
>> outputs this: insert into Student_Status (Student_ID,Status_ID) values(
>> and stops there with this error:
>>
>> Complex object types cannot be converted to simple values.
>>     
>
>
> Could you post the GetLastId() method? My bet is that it is not returning
> what you expect it to... (i.e. a string or a number)
>
> Dominic
>
>   



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:301525
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to