Print Page | Close Window

BUG? New Topic/Forum error ’CLng’

Printed From: Web Wiz Forums
Category: Web Wiz Web App Support Forums
Forum Name: Web Wiz Forums
Forum Description: Support forum for Web Wiz Forums application.
URL: https://forums.webwiz.net/forum_posts.asp?TID=1161
Printed Date: 29 March 2026 at 11:56pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: BUG? New Topic/Forum error ’CLng’
Posted By: NextDoorKid
Subject: BUG? New Topic/Forum error ’CLng’
Date Posted: 20 March 2003 at 2:37am

Hi All.

Just after creatin' a new Forum or Topic, I get the error : " can't cast null value, function: 'CLng'"
Well I figured that this error arises because the number of Topics in the new forum is 0 and the number of Posts is also zero.
So in the database these values are stored as "Null".

Well my solution was to cahnge the foll line:
From : lngPosts = CLng(rsData("No_of_Posts")) 'somethin like dis
TO:
 if IsNumeric(rsData("No_of_Posts")) then
   lngPosts = CLng(rsData("No_of_Posts"))
 else
   lngPosts = 0
 endif

... and the same for the number of topics.

Is this a bug or it just happened on my system only?
Maybe these table fields should not be allowed to take "Null" values therefore forcing the script to input a zero when a new Forum is created.

I'm on wwf7.3 , SQL Server 7, IIS5



-------------
That's the kid.



Replies:
Posted By: WebWiz-Bruce
Date Posted: 20 March 2003 at 2:52am

The problem with SQL server 7, is that it doesn't always input the defualt value. The default value for this field in the database is 0.

SQL srever 2000 is much better at inserting default values and so shouldn't have this problem, but I shall change the SQL server serup script to force the default value to be entered for SQL server 7.



-------------
https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting
https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting


Posted By: NextDoorKid
Date Posted: 20 March 2003 at 3:03am

Thanks -boRg- "as always"

That should do.
i shall also look at SQL 7 and try to figure out why defaults ain't functionin'

Cheers.



-------------
That's the kid.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net