Computer Learning Zone CLZ Access Excel Word Windows

Equipped with his five senses, man explores the universe around him and calls the adventure Science.

-Edwin Hubble
 
Home   Courses   Index   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
 
OK, I fixed it
By Richard Rost   Richard Rost on LinkedIn Email Richard Rost   12 years ago

I was finally able to recreate the problem that has been plaguing a few users for a while now. When you sign up for emails to tell you that the Forums or News Feed (what you're reading now) have been updated, you get a link to click on to come directly here (or to the Forum in question). That link could sometimes freeze and take MINUTES to load, and even then display gibberish.

Well, I finally figured out what the problem is. It was a programming conflict caused by yours truly which involves laziness, shortcuts, and having web site code that's been copied, pasted, and crossed like lights on a Christmas tree.

For those of you who don't care about programming, rest assured the problem has been fixed.

For the rest of you, here's a teaching moment...

I have a global function called MakeLogEntry() which is #included in the ASP of just about every page on my site. It allows me to create my own database log files. The IIS text logs are inadequate so I made my own. In any case, this function works great 99.999% of the time.

However... since I've recently been moving things around, changing code on the fly, yadda yadda yadda... a problem came up where I ended up accidentally having multiple conflicting recordsets loading on the same page. This would ONLY happen if the new user logon code tried to pull up your user record AT THE SAME TIME as trying to save your automatic login attempt to the log file.

Oops. This caused an endless loop and a gibberish recordset to try and display garbage until the script timed out... at about 2 minutes.

Once I discovered the problem it was an easy fix. HOWEVER, this problem wouldn't happened in the first place if I had just not been lazy and properly DIMmed my variables in my functions. See the function looks kind like this:

Function MakeLogEntry(SomeStuff)
set conn = ... database connection
set rs = ... recordset
record the data
set rs = nothing
set conn = nothing
End Function

OK, that's all fine and dandy, but if you don't DIM your variables INSIDE the function, ASP/VB assumes that if the variable already exists on the page that you want to use THAT variable. So when my function code is #included inside another page, if there's already a CONN or RS variable (which there was in this case) it uses those... then destroys those (=Nothing) and that caused the problem.

All I had to do was add one line of code to fix the problem:

Dim Conn, rs

And now those are LOCAL variables inside the function. The other recordsets on the page don't have a cow, and all is well with the world. See... being a lazy programmer WILL come back to bite you in the ass.

Thanks to Chris, Willem, Phillip, Alex, and everyone else who helped me to nail down this problem! You guys are the best.

Comments for OK, I fixed it
 
Age Subject From
12 yearsOK I fixed itKevin Robertson
12 yearsOK I fixed itJames F
12 yearsOK I fixed itRichard R

 

Start a NEW Conversation
 
Only students may post on this page. Click here for more information on how you can set up an account. If you are a student, please Log On first. Non-students may only post in the Visitor Forum.
 
Subscribe
Subscribe to OK, I fixed it
Get notifications when this page is updated
 
 
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2024 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 3/28/2024 7:08:00 AM. PLT: 0s
PermaLink  OK, I fixed it