?
Solved

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

Posted on 2011-03-13
4
Medium Priority
?
1,179 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
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 …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

770 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