Switch the following line in your query
profileID = #Session.Profile.profileID#
Also, you may want to consider transferring the session into a local variable
to be more flexible with your function call
Mike
On Jan 26, 2011, at 12:47 PM, Adam Bourg wrote:
Here's what I'm trying to do. I'm
So the query comes back with no results if it's a student? Why not do
something like?
cfif isStudentEmployee.recordcount eq 0
cfreturn true
cfelse
cfreturn false
/cfif
On 1/26/2011 12:47 PM, Adam Bourg wrote:
Here's what I'm trying to do. I'm building a module that
I also want to add when you run a cfc page with a query sometimes when you get
an error a blank page will occur without any error information.
On Jan 26, 2011, at 12:47 PM, Adam Bourg wrote:
Here's what I'm trying to do. I'm building a module that only our
Professional Staff can access,
Yep this is true - a cftry/cfcatch helps or just run the query outside
of the cfc to see if it's throwing an error.
On 1/26/2011 1:03 PM, Michael Firth wrote:
I also want to add when you run a cfc page with a query sometimes when you
get an error a blank page will occur without any error
Kelly is right with the cftry and cfcatch. If you change your query like this
it should correct your bug I am thinking because when you write a query the
database field has to be on the left. TSQL doesnt know what a session variable
is.
cfquery datasource=#DSN# name=isStudentEmployee
Sorry if I am repeating what anyone else has said, I didn't read the rest of
the thread.
If you catch errors inside the CFC using try/catch you can then return then
in your return struct to inform your calling page that there was an error.
e.g.
cfset Foo = MyCFC.method(vars)
cfif
Got a few questions about your CFC method...
1) where is the variable DSN coming from?
2) Should your WHERE be: WHERE profileID = #session.profile.profileID#
? (essentially the reverse of what you have)
3) consider using cfqueryparam in your SQL when using dynamic values
(yeah, I know... that's
Kelly is right with the cftry and cfcatch. If you change your query like
this it should correct your bug I am thinking because when you write a query
the database field has to be on the left. TSQL doesnt know what a session
variable is.
MSSQL doesn't care if the field is on the left or the
Alan wrote:
MSSQL doesn't care if the field is on the left or the right, it's just
running a comparison against the statement.
Gotta say thats a first and I have been doing mssql for ten years. I am
telling you this is what is causing his error because tsql is not as flexible
as you think
I solved it with the first couple of posts help.
New code:
cffunction name=isStudentEmployee returntype=boolean hint=Method to
determine if the person logged in is a student or pro staffer, will corelate to
a control structure if student employee throw up access denied
Awesome! :)
On 1/26/2011 1:31 PM, Adam Bourg wrote:
I solved it with the first couple of posts help.
New code:
cffunction name=isStudentEmployee returntype=boolean hint=Method
to determine if the person logged in is a student or pro staffer, will
corelate to a control structure if
On Wed, Jan 26, 2011 at 11:31 AM, Adam Bourg adam.bo...@gmail.com wrote:
I solved it with the first couple of posts help.
cfif isStudentEmployee.recordcount eq 0
cfreturn true
cfelse
cfreturn false
/cfif
Glad you got it working.
You can tighten that
I don't know what to tell you Mike, SQL Server doesn't care, it works either
way
SELECT *
FROM PropImage
WHERE
20 = PropertyID works exactly the same as PropertyID = 20
It's just common convention that we use PropertyID = 20
In the internal SQL engine it's just running a logical comparison
This is true. I've done it and it works. It's easy enough to test and
see that Alan is correct.
On 1/26/2011 1:57 PM, Alan Rother wrote:
I don't know what to tell you Mike, SQL Server doesn't care, it works either
way
SELECT *
FROM PropImage
WHERE
20 = PropertyID works exactly the
Charlie, is this true only when the return type is Boolean?
Otherwise, it should return the actual recordcount, right?
Thanks, Che
You could also drop the comparison itself since CF does implicit boolean
conversion.
cfreturn isStudentEmployee.recordcount /
^That'll do the same thing.
Actually, these will not return the same value.
Lets assume the query returns 0 records.
cfreturn isStudentEmployee.recordcount = 0 / will return true
cfreturn isStudentEmployee.recordcount / will return false
On Wed, Jan 26, 2011 at 1:43 PM, Charlie Griefer
charlie.grie...@gmail.com wrote:
Well, it will return the actual recordcount... which is a number. But
CF implicitly converts numeric values to boolean values. Any non-zero
value is true, while any zero value is false.
So given the following code:
cfif myCFC.myMethod()do something/cfif
... assuming myMethod returns a numeric
Let me correct that.
cfreturn isStudentEmployee.recordcount = 0 / will return true
but
cfreturn isStudentEmployee.recordcount / will evaluate to false
On Wed, Jan 26, 2011 at 2:06 PM, Scott Stroz boyz...@gmail.com wrote:
Actually, these will not return the same value.
Lets assume the query
d'oH! Good catch.
So if you go the implicit boolean conversion route, switch the return
true for return false...
On Wed, Jan 26, 2011 at 12:06 PM, Scott Stroz boyz...@gmail.com wrote:
Actually, these will not return the same value.
Lets assume the query returns 0 records.
cfreturn
Gotta say thats a first and I have been doing mssql for ten years. I am
telling you this is what is causing his error because tsql is not as flexible
as you think because its procedural and requires you do it in a certain way.
This is incorrect. Literal values can be placed on either side
One last note. You need to var scope your query.
cfset var isStudentEmployee = /
cfquery name=isStudentEmployee
~|
Order the Adobe Coldfusion Anthology now!
On Wed, Jan 26, 2011 at 10:43 AM, Charlie Griefer
charlie.grie...@gmail.com wrote:
cfreturn isStudentEmployee.recordcount = 0 /
Unless I'm missing something, this should be:
cfreturn isStudentEmployee.recordcount eq 0 /
--
Ezra Parker
On Wed, Jan 26, 2011 at 12:30 PM, Ezra Parker e...@cfgrok.com wrote:
On Wed, Jan 26, 2011 at 10:43 AM, Charlie Griefer
charlie.grie...@gmail.com wrote:
cfreturn isStudentEmployee.recordcount = 0 /
Unless I'm missing something, this should be:
cfreturn isStudentEmployee.recordcount eq 0 /
23 matches
Mail list logo