AccessDataSource - Object reference not set to an instance of an object

Last post 08-31-2009 12:39 PM by pdg. 9 replies.

Sort Posts:

  • AccessDataSource - Object reference not set to an instance of an object

    06-28-2009, 7:45 PM
    • Member
      point Member
    • JESNELL
    • Member since 06-28-2009, 8:14 AM
    • Posts 4

    Greetings,

    I'm new to ASP.Net websites and databases and I'm following examples in a book, as I learn all this. I'm currently following an example in the book on adding and configuring an AccessDataSource and adding a simple Access .mdb that the author created.

    Situation: In VS2008 Standard Edition (while developing a sample website), I'm trying to bring into the App_Data folder an existing Access 2003 database (.mdb) that the author of the book already created. I downloaded the .mdb to my Desktop from the author's website. In VS, when I right-click on the App_Data folder and select "Add Existing Item...", then navigate to and select the .mdb file and try to add it, I get the error message:

    "An error occurred while processing the local data file:
    Object reference not set to an instance of an object."

    When I click the "OK" button on the error message, VS still adds the .mdb to the App_Data folder, but then the next steps in the example in the book no longer work or match up. Obviously, there's some issue with adding the .mdb to the website project, but I can't figure it out after days of researching through my books, MSDN, and visiting several forums.

    Everything in the book has been working properly up until this point.

    I'd really appreciate if anyone has a solution and explanation of what's going on, so I can fully understand and correct it and move forward with my learning. Thank You.

    System:
    Vista Ultimate x64, SP1
    IIS 7 that came with Vista Ult.
    VS2008, SP1
    ASP.Net 3.5, SP1

  • Re: AccessDataSource - Object reference not set to an instance of an object

    06-29-2009, 5:08 AM
    • Star
      8,928 point Star
    • hans_v
    • Member since 01-29-2007, 9:03 PM
    • Posts 1,541

     Although I cannot recreate what your are describing, I might have something what you could do. Since you've downloaded the database, it could be that it is blocked. Can you rightclick the database and choose properties. On the bottom of the general tab, it could be that you see:

    "This file came from another computer and might be blocked". If you do, click on the unblock button

  • Re: AccessDataSource - Object reference not set to an instance of an object

    06-29-2009, 8:29 PM
    • Member
      point Member
    • JESNELL
    • Member since 06-28-2009, 8:14 AM
    • Posts 4

    hans_v:

     Although I cannot recreate what your are describing, I might have something what you could do. Since you've downloaded the database, it could be that it is blocked. Can you rightclick the database and choose properties. On the bottom of the general tab, it could be that you see:

    "This file came from another computer and might be blocked". If you do, click on the unblock button

     

    Hans,

    Thanks for your response. You were correct that the file was set to blocked and I followed your directions to unblock it. But it did not solve the issue. I still get the same error message.

     

  • Re: AccessDataSource - Object reference not set to an instance of an object

    06-30-2009, 3:40 AM
    • Star
      8,928 point Star
    • hans_v
    • Member since 01-29-2007, 9:03 PM
    • Posts 1,541

    jesnell:

    In VS, when I right-click on the App_Data folder and select "Add Existing Item...", then navigate to and select the .mdb file and try to add it, I get the error message:

    "An error occurred while processing the local data file:
    Object reference not set to an instance of an object."

     

    ANd what if you just add the mdb to the App_Data folder in Windows Explorer, and then click the refresh button in VS Explorer?

  • Re: AccessDataSource - Object reference not set to an instance of an object

    06-30-2009, 7:38 PM
    • Member
      point Member
    • JESNELL
    • Member since 06-28-2009, 8:14 AM
    • Posts 4

    hans_v:

    jesnell:

    In VS, when I right-click on the App_Data folder and select "Add Existing Item...", then navigate to and select the .mdb file and try to add it, I get the error message:

    "An error occurred while processing the local data file:
    Object reference not set to an instance of an object."

     

    ANd what if you just add the mdb to the App_Data folder in Windows Explorer, and then click the refresh button in VS Explorer?

     

     

    Hans,

    Using the method you described does allow me to bring it in to App_Data folder, just like "Add Existing Item..." does. The only difference was that using Windows Explorer didn't give VS a chance to throw the error message. But when following the examples in my book to play with the .mdb, everything is thrown off course. I'll describe below in more detail:

    If "Add Existing Item..." worked properly, the next step would be to add and configure the AccessDataSource control on the sample web page, using the "Configure Data Source" in the control's menu. According to the book, that would lead me to "Choose a Database" dialog box and I choose the .mdb. That always worked fine. BUT, in the next step, according to the book, I would get the "Configure the Select Statement" dialog box. I don't get that. Instead, I'm getting the "Define Custom Statements or Stored Procedures" dialog box. And that's where I get lost because it deviates from the book's lessons.

    I just don't know enough about all this to figure my way around it, which is why I'm following this book to learn it...LOL. If the lessons go off track like this, I'm lost.

    Any other help thrown my way is greatly appreciated.

  • Re: AccessDataSource - Object reference not set to an instance of an object

    06-30-2009, 7:55 PM
    • Star
      8,928 point Star
    • hans_v
    • Member since 01-29-2007, 9:03 PM
    • Posts 1,541

    JESNELL:
    BUT, in the next step, according to the book, I would get the "Configure the Select Statement" dialog box. I don't get that. Instead, I'm getting the "Define Custom Statements or Stored Procedures" dialog box
     

     

    Strange! On that page you have a 'Previous' Button. In you click on that buttonm you should be on the 'Configure the Select Statement'. When you click on the radiobutton 'Specify columns from a table or a view' you should be on the right track again.....

    A tutorial which works with Access can be found here

    And maybe you could watch some video's on this site here

    like http://www.asp.net/learn/videos/video-49.aspx

    They use SQL server Express, but for Access it works more or less the same

    And recently I posted another topic on some Access tutorials...

    http://forums.asp.net/t/1434946.aspx#3230330

     

     

  • Re: AccessDataSource - Object reference not set to an instance of an object

    06-30-2009, 10:39 PM
    • Member
      point Member
    • JESNELL
    • Member since 06-28-2009, 8:14 AM
    • Posts 4

    Correct...that's what I should be see or start out with, but I don't. It goes straight to the "Define Custom Statements or Stored Procedures" dialog box and the Previous button just takes me back to selecting a database. I'm guessing that my original issue with importing the .mdb is the source of the problem.

    I'm only guessing, since I don't enought about all this yet, but could there be something wrong in the way my VS2008, IIS, or Vista Ultimate is set up or configured that's causing this? I bought several books on VS2008 and ASP.Net to learn all this, and have gone through them all, as well as the web and various forums to figure out this issue. But nothing I've read touches on this issue, as though it's such a simple thing to do, it can't go wrong. So I'm thinking maybe something is wrong with setup or configuration.

    I'll watch the tutorials you've linked to and see if that sheds any light on things and let you know.

    Thanks.

  • Re: AccessDataSource - Object reference not set to an instance of an object

    08-15-2009, 10:00 AM
    • Member
      4 point Member
    • grovelli
    • Member since 08-15-2009, 1:26 PM
    • Posts 2

    Hi, I have exactly your same couple of problems:
    Object reference not set to an instance of an object and configuring the Select Statement dialog box.

    I'm on XP SP3 and use Visual Web Developer 2008 Express, have you been able to find a solution to either?

  • Re: AccessDataSource - Object reference not set to an instance of an object

    08-15-2009, 10:08 AM
    • Member
      4 point Member
    • grovelli
    • Member since 08-15-2009, 1:26 PM
    • Posts 2

     Hi, are you the same HansV from The Lounge we all love and cherish?Innocent

  • Re: AccessDataSource - Object reference not set to an instance of an object

    08-31-2009, 12:39 PM
    • Member
      4 point Member
    • pdg
    • Member since 08-11-2009, 9:05 AM
    • Posts 2

     I've found on this page the solution. I was experiencing the same problem and this fixed it completely. Here I copy the steps described by the original author:

    1) Run regedit.exe;
    2) Browse to the location "HKEY_CLASSES_ROOT\CLSID\{F9AE8980-7E52-11d0-8964-00C04FD611D7}" in the tree;
    3) If there is a child node in the tree called "ProgID", then you are indeed experiencing a different problem - let me know if this is the case.

    Otherwise, follow these steps to modify the registry:

    1) Right click the node and select "New > Key";
    2) Enter "ProgID" as the name;
    3) Go to the main window and double click "(Default)";
    4) Enter the value "MSIDXS.1";

Page 1 of 1 (10 items)