Print Page | Close Window

Invalid use of Null

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=29256
Printed Date: 01 April 2026 at 10:27am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Invalid use of Null
Posted By: stevehal
Subject: Invalid use of Null
Date 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



Replies:
Posted By: WebWiz-Bruce
Date 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.


-------------
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: stevehal
Date 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



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