PowerTip: Mini-Scripting Games 2014 Answer 3

Summary: Here is the answer to the third question in Mini-Scripting Games 2014.

Hey, Scripting Guy! Question You are writing a script, and when it runs, you receive an error message that states:
               “You cannot call a method on a null-valued expression."
           What is the first thing you should check?

Hey, Scripting Guy! Answer Check the code that creates the object that you stored in the variable. It is probable that there is a
            problem with that code. For example, let's say I read from a database and store the results from
            that database to a variable, and then I call the MoveNext() method.

   If I get an error message that tells me I cannot call a method on a null-valued expression, it means that
   I did not successfully connect to the database or I did not return a record set from the database.

   This could be due to an invalid query or a query that returned no rows from the database.