0
Stange Cfquery NULL Error:
Participant
,
/t5/coldfusion-discussions/stange-cfquery-null-error/td-p/405803
Apr 07, 2008
Apr 07, 2008
Copy link to clipboard
Copied
I was working on the project when i came to a sudden problem,
Where i was running into an error.
The error was sometimes appearing and sometimes not so i just tries to use th IsNull UDF from cflib library but still error persists:
here is the error: i recieve:
The system has attempted to use an undefined value, which usually
indicates a programming error, either in your code or some system
code.
Null Pointers are another name for undefined values.
and this was my query that where i used iSnull and Still getting the error:
<cfquery name="qGetArticleInfo" datasource="#Request.ConsultantTrackSiteDSN#">
SELECT SiteSections_LOOKUP.SiteSectionName, SiteSections_LOOKUP.SiteSection_ID, Articles.ImageFileName, Articles.Content, Articles.CallOut, Articles.Teaser, Articles.Title, Articles.dtStartDate, Articles.SubTitle, Articles.Article_ID, Articles.lColumnLengths, Articles.iCalloutWidth, Articles.ImageHeight, Articles.ImageWidth, Articles.bPDFArticle, Articles.PDFFileName, Articles.SmallImageFileName, Articles.SmallImageWidth, Articles.SmallImageHeight, Articles.SmallImageOriginalFileName
FROM SiteSections_LOOKUP INNER JOIN Articles ON SiteSections_LOOKUP.SiteSection_ID = Articles.SiteSection_ID
WHERE Articles.bDeleted = 0
<cfif IsNull(IsDefined("Attributes.Article_ID"))>
AND Articles.Article_ID = #Attributes.Article_ID#
<cfelseif IsNull(IsDefined("Attributes.SiteSection_ID"))>
AND Articles.bActive <> 0 AND Articles.SiteSection_ID = #Attributes.SiteSection_ID# AND Articles.dtStartDate <= #CreateODBCDate(Now())#
</cfif>
ORDER BY Articles.dtStartDate DESC, Articles.Title
</cfquery>
i tried a lot but in vain can anybody help in this instance..
The error was sometimes appearing and sometimes not so i just tries to use th IsNull UDF from cflib library but still error persists:
here is the error: i recieve:
The system has attempted to use an undefined value, which usually
indicates a programming error, either in your code or some system
code.
Null Pointers are another name for undefined values.
and this was my query that where i used iSnull and Still getting the error:
<cfquery name="qGetArticleInfo" datasource="#Request.ConsultantTrackSiteDSN#">
SELECT SiteSections_LOOKUP.SiteSectionName, SiteSections_LOOKUP.SiteSection_ID, Articles.ImageFileName, Articles.Content, Articles.CallOut, Articles.Teaser, Articles.Title, Articles.dtStartDate, Articles.SubTitle, Articles.Article_ID, Articles.lColumnLengths, Articles.iCalloutWidth, Articles.ImageHeight, Articles.ImageWidth, Articles.bPDFArticle, Articles.PDFFileName, Articles.SmallImageFileName, Articles.SmallImageWidth, Articles.SmallImageHeight, Articles.SmallImageOriginalFileName
FROM SiteSections_LOOKUP INNER JOIN Articles ON SiteSections_LOOKUP.SiteSection_ID = Articles.SiteSection_ID
WHERE Articles.bDeleted = 0
<cfif IsNull(IsDefined("Attributes.Article_ID"))>
AND Articles.Article_ID = #Attributes.Article_ID#
<cfelseif IsNull(IsDefined("Attributes.SiteSection_ID"))>
AND Articles.bActive <> 0 AND Articles.SiteSection_ID = #Attributes.SiteSection_ID# AND Articles.dtStartDate <= #CreateODBCDate(Now())#
</cfif>
ORDER BY Articles.dtStartDate DESC, Articles.Title
</cfquery>
i tried a lot but in vain can anybody help in this instance..
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/coldfusion-discussions/stange-cfquery-null-error/m-p/405804#M36479
Apr 07, 2008
Apr 07, 2008
Copy link to clipboard
Copied
check how you are using isnull() udf and how it actually
should be used.
some pointers:
isdefined() returns either TRUE or FALSE
isnull() udf returns either TRUE or FALSE
see your mistakes?
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
some pointers:
isdefined() returns either TRUE or FALSE
isnull() udf returns either TRUE or FALSE
see your mistakes?
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
thenotorious_flag
AUTHOR
Participant
,
/t5/coldfusion-discussions/stange-cfquery-null-error/m-p/405805#M36480
Apr 07, 2008
Apr 07, 2008
Copy link to clipboard
Copied
i changed a bit a code but still no sucees, here is my
updated code:
<cfquery name="qGetArticleInfo" datasource="#Request.ConsultantTrackSiteDSN#">
SELECT SiteSections_LOOKUP.SiteSectionName, SiteSections_LOOKUP.SiteSection_ID, Articles.ImageFileName, Articles.Content, Articles.CallOut, Articles.Teaser, Articles.Title, Articles.dtStartDate, Articles.SubTitle, Articles.Article_ID, Articles.lColumnLengths, Articles.iCalloutWidth, Articles.ImageHeight, Articles.ImageWidth, Articles.bPDFArticle, Articles.PDFFileName, Articles.SmallImageFileName, Articles.SmallImageWidth, Articles.SmallImageHeight, Articles.SmallImageOriginalFileName
FROM SiteSections_LOOKUP INNER JOIN Articles ON SiteSections_LOOKUP.SiteSection_ID = Articles.SiteSection_ID
WHERE Articles.bDeleted = 0
<cfif IsNull("Attributes.Article_ID")>
AND Articles.Article_ID = #Attributes.Article_ID#
<cfelseif IsNull("Attributes.SiteSection_ID")>
AND Articles.bActive <> 0 AND Articles.SiteSection_ID = #Attributes.SiteSection_ID# AND Articles.dtStartDate <= #CreateODBCDate(Now())#
</cfif>
ORDER BY Articles.dtStartDate DESC, Articles.Title
</cfquery>
but if remove th Isnull, and use only isdefined, then error still persists, no knowing what is going wrong here..
<cfquery name="qGetArticleInfo" datasource="#Request.ConsultantTrackSiteDSN#">
SELECT SiteSections_LOOKUP.SiteSectionName, SiteSections_LOOKUP.SiteSection_ID, Articles.ImageFileName, Articles.Content, Articles.CallOut, Articles.Teaser, Articles.Title, Articles.dtStartDate, Articles.SubTitle, Articles.Article_ID, Articles.lColumnLengths, Articles.iCalloutWidth, Articles.ImageHeight, Articles.ImageWidth, Articles.bPDFArticle, Articles.PDFFileName, Articles.SmallImageFileName, Articles.SmallImageWidth, Articles.SmallImageHeight, Articles.SmallImageOriginalFileName
FROM SiteSections_LOOKUP INNER JOIN Articles ON SiteSections_LOOKUP.SiteSection_ID = Articles.SiteSection_ID
WHERE Articles.bDeleted = 0
<cfif IsNull("Attributes.Article_ID")>
AND Articles.Article_ID = #Attributes.Article_ID#
<cfelseif IsNull("Attributes.SiteSection_ID")>
AND Articles.bActive <> 0 AND Articles.SiteSection_ID = #Attributes.SiteSection_ID# AND Articles.dtStartDate <= #CreateODBCDate(Now())#
</cfif>
ORDER BY Articles.dtStartDate DESC, Articles.Title
</cfquery>
but if remove th Isnull, and use only isdefined, then error still persists, no knowing what is going wrong here..
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/coldfusion-discussions/stange-cfquery-null-error/m-p/405806#M36481
Apr 07, 2008
Apr 07, 2008
Copy link to clipboard
Copied
the code inside <cfif IsNull("Attributes.Article_ID")>
block will be
processed if it evaluates to TRUE, which is when attributes.article_id
is null - is that your intention?
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
processed if it evaluates to TRUE, which is when attributes.article_id
is null - is that your intention?
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Mentor
,
/t5/coldfusion-discussions/stange-cfquery-null-error/m-p/405807#M36482
Apr 07, 2008
Apr 07, 2008
Copy link to clipboard
Copied
Is this closer to what you are trying to do?
<cfif IsDefined("Attributes.Article_ID") AND NOT IsNull("Attributes.Article_ID")>
AND Articles.Article_ID = #Attributes.Article_ID#
<cfelseif IsDefined("Attributes.SiteSection_ID") AND NOT IsNull("Attributes.SiteSection_ID")>
AND Articles.bActive <> 0 AND Articles.SiteSection_ID = #Attributes.SiteSection_ID#
AND Articles.dtStartDate <= #CreateODBCDate(Now())#
</cfif>
Phil
<cfif IsDefined("Attributes.Article_ID") AND NOT IsNull("Attributes.Article_ID")>
AND Articles.Article_ID = #Attributes.Article_ID#
<cfelseif IsDefined("Attributes.SiteSection_ID") AND NOT IsNull("Attributes.SiteSection_ID")>
AND Articles.bActive <> 0 AND Articles.SiteSection_ID = #Attributes.SiteSection_ID#
AND Articles.dtStartDate <= #CreateODBCDate(Now())#
</cfif>
Phil
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
thenotorious_flag
AUTHOR
Participant
,
/t5/coldfusion-discussions/stange-cfquery-null-error/m-p/405808#M36483
Apr 07, 2008
Apr 07, 2008
Copy link to clipboard
Copied
basically we are just shifting from one server to another and
using database mysql, so this error was coming up, no matter how. i
am trying different approaches told by u guys and by own brain
storms but still theat same kinda error:
Well i am stuck here?
Well i am stuck here?
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Engaged
,
/t5/coldfusion-discussions/stange-cfquery-null-error/m-p/405809#M36484
Apr 07, 2008
Apr 07, 2008
Copy link to clipboard
Copied
There is no such thing as a NULL in ColdFusion, if you are
using some Java that can return NULLs then it will not create the
variable at all, and if it already existed it will now not exist.
I do not see how the code you are showing us can have a null pointer exception, I suggest you step through the code line by line cfdumping what you have until you get the correct line number of the error.
I do not see how the code you are showing us can have a null pointer exception, I suggest you step through the code line by line cfdumping what you have until you get the correct line number of the error.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Mentor
,
LATEST
/t5/coldfusion-discussions/stange-cfquery-null-error/m-p/405810#M36485
Apr 08, 2008
Apr 08, 2008
Copy link to clipboard
Copied
Does something like this work?
<cfif IsDefined("Attributes.Article_ID") AND Attributes.Article_ID NEQ "">
AND Articles.Article_ID = #Attributes.Article_ID#
<cfelseif IsDefined("Attributes.SiteSection_ID") AND Attributes.SiteSection_ID NEQ "")>
AND Articles.bActive <> 0
AND Articles.SiteSection_ID = #Attributes.SiteSection_ID#
AND Articles.dtStartDate <= #CreateODBCDate(Now())#
</cfif>
Phil
<cfif IsDefined("Attributes.Article_ID") AND Attributes.Article_ID NEQ "">
AND Articles.Article_ID = #Attributes.Article_ID#
<cfelseif IsDefined("Attributes.SiteSection_ID") AND Attributes.SiteSection_ID NEQ "")>
AND Articles.bActive <> 0
AND Articles.SiteSection_ID = #Attributes.SiteSection_ID#
AND Articles.dtStartDate <= #CreateODBCDate(Now())#
</cfif>
Phil
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

