Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - BUG? New Topic/Forum error ’CLng’
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

BUG? New Topic/Forum error ’CLng’

 Post Reply Post Reply
Author
NextDoorKid View Drop Down
Newbie
Newbie
Avatar

Joined: 18 March 2003
Location: United Kingdom
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote NextDoorKid Quote  Post ReplyReply Direct Link To This Post Topic: BUG? New Topic/Forum error ’CLng’
    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



Edited by NextDoorKid
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post 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.

Back to Top
NextDoorKid View Drop Down
Newbie
Newbie
Avatar

Joined: 18 March 2003
Location: United Kingdom
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote NextDoorKid Quote  Post ReplyReply Direct Link To This Post 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.

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.