Solved

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

Posted on 2011-03-13
4
1,164 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
  • 3
4 Comments
 
LVL 6

Accepted Solution

by:
Ramone_Hamilton earned 250 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Access 2016 - Query Challenge 15 51
Error in SQL Query 36 39
sql query Help 12 34
SyBase Query Syntax Date Time conversion 4 13
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
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 …
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

744 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now