Home > Net >  Access database of concurrent Access
Access database of concurrent Access

Time:10-06

Have A question want to consult everybody, existing A Access database is A by A program to regularly write data in the form of monopoly, now I want to write A c # program B to read-only Access to the database file, I don't need to edit, update, etc., only need to read the data inside, excuse me each bosses, this can be achieved, c # program to connect to the database of the string and how to write? Online, wait! thank you

CodePudding user response:

Read only roles and then build procedure for the database B in that role

CodePudding user response:

 
The DataTable Access (string comand)
{
String strConn="Provider=Microsoft. ACE. The OLEDB. 12.0; Data source=C: \ \ Users \ \ 2019 \ \ XXXX accdb; Persist Security Info=False ";
The DataTable dt=new DataTable ();
OleDbConnection conn=new OleDbConnection (strConn);
Conn. The Open ();
OleDbDataAdapter myCommand=new OleDbDataAdapter (comand, strConn);

MyCommand. The Fill (dt);
Conn. Close ();
Return dt.
}

CodePudding user response:

reference 1/f, 711 glaciers response:
create read-only role for database and application B in that role.

I USES a local area network (LAN) sharing the database file, create a read only role is to the Shared folder and file sharing read-only property?

CodePudding user response:

refer to the second floor m0_37646670 response:
 
The DataTable Access (string comand)
{
String strConn="Provider=Microsoft. ACE. The OLEDB. 12.0; Data source=C: \ \ Users \ \ 2019 \ \ XXXX accdb; Persist Security Info=False ";
The DataTable dt=new DataTable ();
OleDbConnection conn=new OleDbConnection (strConn);
Conn. The Open ();
OleDbDataAdapter myCommand=new OleDbDataAdapter (comand, strConn);

MyCommand. The Fill (dt);
Conn. Close ();
Return dt.
}

The connection string does not need to provide access pattern Mode=read
?

CodePudding user response:

No need, the query command your own control.
Were introduced to the SELECT command, not to UPDATE/INSERT not only query is not changed

CodePudding user response:

Not recommended for concurrent ACCESS, if you want to concurrency, you need to use the connection pool,
  •  Tags:  
  • C#
  • Related