Solved

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

Posted on 2011-03-13
4
1,171 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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

828 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