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;" +
//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;
//BLOWS UP HERE