Home  >  Article  >  Backend Development  >  Detailed introduction: When using c# to access the Access database, it prompts that the installable ISAM cannot be found (picture)

Detailed introduction: When using c# to access the Access database, it prompts that the installable ISAM cannot be found (picture)

黄舟
黄舟Original
2017-03-11 13:22:481885browse


When using c# to access the Access database, it prompts Cannot find installable ISAM, as shown below:
Detailed introduction: When using c# to access the Access database, it prompts that the installable ISAM cannot be found (picture)

Code As follows:

connectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=db.mdb;Pwd=abcd;";
            conn = new OleDbConnection(connectionString);

            conn.Open();

            DataTable dt = conn.GetSchema("Tables");

            if (dt != null && dt.Rows.Count != 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++ )
                {
                    listBox1.Items.Add(dt.Rows[i]["TABLE_NAME"].ToString());
                }
            }

            conn.Close();

After many modifications and tests, it was found that as long as unrecognizable keywords and configuration project names appear in the connection string, a prompt cannot be installed with ISAM will be prompted. mistake.
The "Pwd" in the above connection string is available in the SQL Server connection string, but it is not recognized in Access.

For example, the following statement will also prompt Cannot find the installable ISAM error:

connectionString = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=db.mdb;abcd=123";

Correct connection string writing:

connectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=db.mdb;jet oledb:database password=123;";
//或者:            
connectionString = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=db.mdb;jet oledb:database password=123;";

When using c# to access the Access database, it prompts Cannot find installable ISAM, as shown below:
Detailed introduction: When using c# to access the Access database, it prompts that the installable ISAM cannot be found (picture)

The code is as follows :

connectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=db.mdb;Pwd=abcd;";
            conn = new OleDbConnection(connectionString);

            conn.Open();

            DataTable dt = conn.GetSchema("Tables");

            if (dt != null && dt.Rows.Count != 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++ )
                {
                    listBox1.Items.Add(dt.Rows[i]["TABLE_NAME"].ToString());
                }
            }

            conn.Close();

After many modifications and tests, it was found that as long as unrecognizable keywords and configuration project names appear in the connection string, an error cannot be found for installing ISAM will be prompted. .
The "Pwd" in the above connection string is available in the SQL Server connection string, but it is not recognized in Access.

For example, the following statement will also prompt Cannot find the installable ISAM error:

connectionString = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=db.mdb;abcd=123";

Correct connection string writing:

connectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=db.mdb;jet oledb:database password=123;";
//或者:            
connectionString = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=db.mdb;jet oledb:database password=123;";

The above is the detailed content of Detailed introduction: When using c# to access the Access database, it prompts that the installable ISAM cannot be found (picture). For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn