Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Invalid use of Null
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Invalid use of Null

 Post Reply Post Reply
Author
stevehal View Drop Down
Groupie
Groupie


Joined: 07 December 2003
Status: Offline
Points: 32
Post Options Post Options   Thanks (0) Thanks(0)   Quote stevehal Quote  Post ReplyReply Direct Link To This Post Topic: Invalid use of Null
    Posted: 15 April 2011 at 7:10pm
A quick note... Maybe nothing you have to do...
 
One of our forums was updated a long time ago from Access to MSSql. Likely all the default values did not carry over. I have had to go in and set default values from time to time. Most of the time it has to do with Null's when it should be a Zero. For example, today I added a new forum to a category, so it obviously did not have any posts in it. Upon adding it, I got a forum error:
 
Microsoft VBScript runtime error '800a005e'

Invalid use of Null: 'CLng'

/Forums/default.asp, line 531

So, I just commented out the line that had the error:
 
lngNumberOfPosts = CLng(sarryForums(7, intCurrentRecord))
 
Then I made a post, removed the comment, and the error was gone. Of course all I have to do is set a default value of 0 to No_of_posts in the tblForum, which I did also.
 
But I just wanted to ask is there any easy way of restablishing default values for a MSSql database other than fixing it as I go along and an error occurs? Maybe a simple script that resets default values on the entire forum would be neat. Or a simple sql command to run that would look for all numerical colums and set the default to 0 or going through the entire database manually? But maybe this is not super important because this may not be happening every day. I did want to mention this in case others get the above error after an upgrade from one database type to another... that you MAY have to set default values for fields that expect a number, because a null could fire an error. It does seem that default values are not established when certain conversion tools convert from Acces to MSSql.
 
Thanks!
 
Steve
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
Answer Answer
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post Posted: 15 April 2011 at 8:26pm
The default values are not normally dropped when upsizing from Access to SQL Server unless you use another tool other than the Access upsize tool or the Microsoft Access Migration Tool.

The only thing you can do now is create a clean database and then compare it against your own to add in the default values, indexes, primary keys, foreign keys, and relationships, which more likely also got dropped if the default values where not carried across.
Back to Top
stevehal View Drop Down
Groupie
Groupie


Joined: 07 December 2003
Status: Offline
Points: 32
Post Options Post Options   Thanks (0) Thanks(0)   Quote stevehal Quote  Post ReplyReply Direct Link To This Post Posted: 15 April 2011 at 8:39pm

Hi Bruce,

Yes, I undersand. I have cleaned up most of it already I believe. But I converted a large forum and the migration tool did actually WORSE than using a tool like the free http://www.bullzip.com/products/a2s/info.php - http://www.bullzip.com/products/a2s/info.php tool. I cannot remember the problem with the Migration tool, but some fields were not carrying over correctly or something.
 
Anyway, I just brought this up in case there was a good answer or if others could be helped by it. Some of the indexes were not created... but the forum is running smoothly except for the occasionl null. But those are few and far between because I think most have been discovered already.
 
Thanks,
 
Steve
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.