Đang chuẩn bị liên kết để tải về tài liệu:
Connecting to a Secured Access Database
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Connecting to a Secured Access Database Problem You want to connect to a Microsoft Access database that has been secured with user-level security and a workgroup file. Solution Use the Jet OLEDB:System Database attribute in the connection string to specify the path and filename of the workgroup information file or system database. | Team LiB Team LiB Recipe 1.4 Connecting to a Secured Access Database Problem You want to connect to a Microsoft Access database that has been secured with user-level security and a workgroup file. Solution Use the Jet OLEDB System Database attribute in the connection string to specify the path and filename of the workgroup information file or system database. The sample code contains a single event handler Connect Button.Click Creates and opens a connection to a Microsoft Access database secured with userlevel security and a workgroup file using the OLE DB .NET data provider. Information about the database is displayed from the properties of the OleDbConnection object. The C code is shown in Example 1-4. Example 1-4. File AccessSecureForm.cs Namespaces variables and constants using System using System.Configuration using System.Text using System.Data.OleDb . . . private void connectButton_Click object sender System.EventArgs e StringBuilder result new StringBuilder Build the connection string with security information. String connectionString ConfigurationSettings.AppSettings MsAccess_ConnectString @ Jet OLEDB System database Team LiB ConfigurationSettings.AppSettings MsAccess_SecureMdw_Filename User ID userldTextBox.Text Password- passwordTextBox.Text Environment.NewLine Environment.NewLine result.Append connectionString Create the connection. OleDbConnection conn new OleDbConnection connectionString try Attempt to open the connection. conn.Open result.Append Connection State conn.State Environment.NewLine OLE DB Provider conn.Provider Environment.NewLine Server Version conn.ServerVersion Environment.NewLine conn.Close result.Append Connection State conn.State Environment.NewLine catch System.Data.OleDb.OleDbException ex result.Append ERROR ex.Message resultTextBox.Text result.ToString Discussion Microsoft Access user-level security requires an additional file the workgroup information or MDW file in addition to the database or MDB file. This file contains the .