Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

"Record(s) cannot be read; no read permission on <tablename>"

Posted on 2011-03-13
4
Medium Priority
?
1,186 Views
Last Modified: 2013-11-29
I work with SQL Server every day, but never touch Access, and have been called on to do a quick one-off console application against Access for a good cause. I've written the whole thing and think it should work, but it's blowing up on my query to the database.  

I can open the database  in Access 2010 and use it normally. Also, when running my project the OleDbConnection object is able to open the database without complaint. When trying to query a table, though, I get this error:  "Record(s) cannot be read; no read permission on '<tablename>'."

I see no sign of a workgroup file or anything unusual (anything at all, really) having been done with security in the database, so I don't think that's it. I wonder if it has something to do with the context the app is running in.

Assistance will be much appreciated. This is important, but a piddly little project and since this is probably the only thing standing between me and handing this off, I want to get it figured out as soon as possible.  Thanks!

Here's the essence of the code in question, written (obviously) in C# in Visual Studio 2010:


OleDbConnection conn = new OleDbConnection();
            conn.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;" +
                @"Data source=C:\Data\2010_People.peo";
            try
            {
                conn.Open();
                //This works fine
            }
            catch (Exception ex)
            {
               ...
            }

...

               oDS = new DataSet();
                sSQL = @"SELECT FName, LName, NZ(EmailAddress,WEmailAddress) AS EmailAddress FROM tblPeople WHERE BidderNumber = " + sBidderNumber.Trim();
                oCmd = new OleDbCommand(sSQL, conn);
                oAd = new OleDbDataAdapter();
                oAd.SelectCommand = oCmd;
                try
                {
                    oAd.Fill(oDS);
                    //BLOWS UP HERE
                }
                catch(Exception oEx)
                {
                    ...
                }

Open in new window

0
Comment
Question by:ken_crosson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 6

Accepted Solution

by:
Ramone_Hamilton earned 1000 total points
ID: 35121705
I have a couple of suggestions.

Is the database an access 2010 database?  If not is it possible to upgrade it to 2010?  The reason I ask is that the provider you are using to connect to access in your connection string is much older than Access 2010 which is version 14.0.  Maybe that could solve your problem?

Is the file, while able to be opened in access, an access database?  I have not seen that file extension before.
0
 

Author Comment

by:ken_crosson
ID: 35121793
Neither have I. I don't have any more details on its origin -- I can probably ask tomorrow, but I was hoping to wrap this up before then.

I think it's an Access database with a custom extension for some rinky-dink software app -- if I rename it with an .MDB extension or a .ACCDB extension I can open it in Access, where it says in the title bar that it is Access 2000 format.

I'll try upgrading it or moving the data to an Access 2010 database, and go look up what provider I should be using.
0
 

Author Comment

by:ken_crosson
ID: 35121877
Replaced that provider with Microsoft.ACE.OLEDB.12.0, upgraded the database to Access 2007 format, and it worked like a charm. Had to get rid of the Nz function, but that wasn't a problem.

Now I'm going to go back and see if the updated provider can work with the original database, but requiring an upgrade shouldn't be a showstopper.

Problem solved (and fast)! Thanks a ton.
0
 

Author Closing Comment

by:ken_crosson
ID: 35121881
I'll call it complete, although feeding me the name of the right provider to use wouldn't have hurt. But it took three seconds to find it on Google.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question