I have an ASP.NET page that needs to push some data to an older program that uses an Access 2003 database for a backend. I have my connection strings all set up to do this (successful to a local copy of the DB) but when I try to read from the database on its network share location, I get the following error:
Record(s) cannot be read; no read permission on 'tblDevice'.
There are no passwords or any security on the database, so I'm pretty sure this is network related. I'm not aware of any way to include a network login/password with the connection string. I would assume it's going to require adding a certain user to the folder. However, I'm not sure what user needs permission to that folder for it to work (both from Visual Studio and from IIS). Anyone had experience with this type of error or know what "users" need to be given permission to the folder?
My code for reference:
Access connection string
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\srv.local\SHAREDOCS\data.mdb;
User Id=admin;Password=;
Selection Code
public static DataTable GetDevices(string serialNum)
{
var conn = new OleDbConnection();
var builder = new OleDbConnectionStringBuilder();
builder.ConnectionString = ConfigurationManager.ConnectionStrings["development"].ToString();
conn = builder.ConnectionString;
var sqlString = "SELECT DeviceID, SN FROM tblDevice WHERE Active=True AND SN=@serialNum ORDER BY SN, DeviceID; "
using (var cmd = new OleDbCommand(sqlString, conn))
{
cmd.Parameters.AddWithValue("@serialNum", serialNum);
var ds = new DataSet();
var da = new OleDbDataAdapter(cmd);
da.Fill(ds);
return ds.Tables[0];
}
}