Solved

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

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

785 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