Results 1 to 8 of 8

Thread: VB2010 with Access problem

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2011
    Posts
    7

    VB2010 with Access problem

    OK, let me preface the issue I am going to describe by saying I am a total noob to programming. I've been taking a class in VB.NET where we were using VB2008 but I couldn't get it to install on my Win7 system so I downloaded VB2010 Express. I already had MS Office Access installed and working.

    OK, I start taking this class. The textbook is "Clearly Visual Basic" for VB2008. Every time I start working on a project Visual Studio pops the conversion wizard to upgrade the project for use on my platform. I've had no problem, other than my own learning curve, getting the projects I downloaded from the author's site to work. Until I hit the chapter where we start using databases, the one chapter I am most interested in learning.

    I open the downloaded project, convert it, go through the fairly simple steps to set up a DataGridView on a form. I went through the connection wizard to set up the new database connection, selected my data source and configured it by the instructions. I tested the connection, no problem so far. I used the connection string for Access by the book, checked the boxes in the proper table and away we went. All the code produced and the objects in the tray look right, everything seemed exactly as it should. But it doesn't work.

    When I run the project I get the form to pop up, it shows the column headings for all the fields in the records, but no data appears at all. Zero records according to the BindingNavigator. I can do a Data Preview and see all the records just fine, but my form does not display any of them.

    I'm lost, no idea how to troubleshoot this. I opened a couple of other projects from this chapter and seem to have the exact same problem with them. My code is below:
    vb.net Code:
    1. ' Name:         Raye Industries Project
    2. ' Purpose:      Display the records stored in a database
    3. ' Programmer:   <your name> on <current date>
    4.  
    5. Public Class frmMain
    6.  
    7.     Private Sub TblEmployBindingNavigatorSaveItem_Click(sender As System.Object, e As System.EventArgs) Handles TblEmployBindingNavigatorSaveItem.Click
    8.         Me.Validate()
    9.         Me.TblEmployBindingSource.EndEdit()
    10.         Me.TableAdapterManager.UpdateAll(Me.EmployeesDataSet)
    11.  
    12.     End Sub
    13.  
    14.     Private Sub frmMain_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
    15.         'TODO: This line of code loads data into the 'EmployeesDataSet.tblEmploy' table. You can move, or remove it, as needed.
    16.         Me.TblEmployTableAdapter.Fill(Me.EmployeesDataSet.tblEmploy)
    17.  
    18.     End Sub
    19. End Class
    As you can see, this is diapers-grade programming, and I've been through the whole routine three times with the same result, so I don't think I am doing anything wrong. There seems to be some problem running VB2008 stuff on VB2010 when you have database access. Any advice or suggestions is greatly appreciated.

    Thanx in advance,
    CC

  2. #2

    Thread Starter
    New Member
    Join Date
    May 2011
    Posts
    7

    Re: VB2010 with Access problem

    Perhaps a clue. I put a TryCatch in the app and got the following error to show up that I didn't realize was happening:

    The 'Microsoft.ace.oledb.12.0' provider is not registered on the local machine.

    Digging into this makes me think I have a problem using the 32-bit Access 2007 with the 64-bit Visual Studio by what I am finding on the intarwebs. I've tried installing the 32-bit Access runtime and database engine as some have suggested on other forums but it didn't fix the problem. Maybe my connection string, or maybe I just have to move back to my old XP box and start over. What a hassle.

  3. #3
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: VB2010 with Access problem

    If you are running on a 64 bit system. You need to target the CPU for x86 instead of Any. The issue is the drivers are only 32 bit.
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  4. #4

    Thread Starter
    New Member
    Join Date
    May 2011
    Posts
    7

    Re: VB2010 with Access problem

    Interesting reply, what you say sure has a believable ring to it. I'm just not sure I understand what you are recommending. Is this a property in VB or something with the hardware or OS?

    Sorry for my ignorance, I know a little about computers but I'm still pretty green on programming stuff. I got a reply from my VB instructor that I'm going to investigate as well, but right now I am trying to resurrect my old XP box as a last resort. It's pretty far beind on MS updates and stuff, and I need to load VB2008 and Access on it so I don't have the Win7 box available right this moment.

    I'll snoop around once I get the newer maching back online and see what I can figure out.


    Thanx Gary,
    CC

  5. #5
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: VB2010 with Access problem

    It is a setting in VS Select the project and then Use configration manager and create an x86 config if not there already
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  6. #6

    Thread Starter
    New Member
    Join Date
    May 2011
    Posts
    7

    Re: VB2010 with Access problem

    OK, I was able to get the old XP machine running again, did all the updates and installed VB2008 and Access, ran through the project and it worked like a charm. I am gonna Ghost this beast so I have an image of the latest state it is in. Then when I get home from work tomorrow I'll try what has been suggested and see if I can get the new box to do what I need.

    Thanx again Gary, I'll be back up here bragging or whining by Friday, but now it is bed time for this old man. I've had enough Microsoft shennanigans for one day.

  7. #7

    Thread Starter
    New Member
    Join Date
    May 2011
    Posts
    7

    Re: VB2010 with Access problem

    Bummer. It does not appear I have this option in VB Express. I found in the Compile tab of properties where it has the Platforme set to ANY but in the pulldown that is the only option. I may try to put VS Ultimate on here and see if I can get to it with that version. I think I can register it and get a 90-day trial, which would get me a long way down the road, so at this point I think that is my next step.

    'Course, I can always run that XP box, but that thing is a dawg so not exactly my first choice, but at least I have a workaround.

    C

  8. #8

    Thread Starter
    New Member
    Join Date
    May 2011
    Posts
    7

    Re: VB2010 with Access problem

    OK ... UNCLE!!! I give up.

    I loaded VS2010 Pro and tried to build the project with the CPU option set to x86. As soon as I try to add a new data source, an Access db file that is provided with the project, I get an error saying "invalid database format." The file opened in VB2010 and 2008 Express no problem, so I don't know what in the world is going on here. I'm just firing up the old XP machine until I can finish these next few chapters.

    I feel like a dog chasing his tail.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width