使用DSN连接到Access数据库的OLEDB

时间:2022-09-27 11:01:02

Hai

i want oledb connection using Dsn. I used the following code

我希望使用Dsn进行oledb连接。我使用了以下代码

'Dsn Create
 dbRegBase.RegisterDatabase("GEMINI", "Microsoft Access Driver (*.mdb)", True,DBQ=D:\Gemini\GEMINI\database\paints_01_2008-2009.mdb
Description=Greenchip Technologies ODBC Database File Path
OemToAnsi=No
UID=admin
PWD=XXXXXX

conection code
Provider=Microsoft.Jet.OLEDB.4.0;DBQ ='GEMINI';Persist Security Info=False;Jet OleDB:Database Password = XXXXXX

But Error come error name is "Could not find installable ISAM" what i do . please tell me.

但错误来的错误名称是“找不到可安装的ISAM”我做什么。请告诉我。

2 个解决方案

#1


My question is why would anyone want to use odbc? There are many sites out there that show the speed improvements of oledb vs odbc. Also, odbc has not been updated in a while and is very buggy.

我的问题是为什么有人想要使用odbc?有很多站点显示oledb vs odbc的速度提升。此外,odbc一段时间没有更新,非常多。

#2


Does it need to be an OleDB connection?

它需要是OleDB连接吗?

I tried using OleDB in my most recent application and failed miserably but managed using and OdbcConnection and DSN.

我尝试在最近的应用程序中使用OleDB,并且失败但是使用OdbcConnection和DSN进行管理。

String query = "SELECT * FROM myTable"; //Complete this for your specific query
OdbcConnection con = new OdbcConnection("DSN=DatabaseName");
OdbcCommand com = new OdbcCommand("Query...", con);
try
{
    con.Open();
    OdbcReader reader = com.ExecuteReader();

    while(reader.Read())
    {
        //Do things with the results
    }
}
catch(Exception ex)
{
    //Exception handling
}

A lot friendlier than using OleDB I think.

我认为比使用OleDB更友好。

#1


My question is why would anyone want to use odbc? There are many sites out there that show the speed improvements of oledb vs odbc. Also, odbc has not been updated in a while and is very buggy.

我的问题是为什么有人想要使用odbc?有很多站点显示oledb vs odbc的速度提升。此外,odbc一段时间没有更新,非常多。

#2


Does it need to be an OleDB connection?

它需要是OleDB连接吗?

I tried using OleDB in my most recent application and failed miserably but managed using and OdbcConnection and DSN.

我尝试在最近的应用程序中使用OleDB,并且失败但是使用OdbcConnection和DSN进行管理。

String query = "SELECT * FROM myTable"; //Complete this for your specific query
OdbcConnection con = new OdbcConnection("DSN=DatabaseName");
OdbcCommand com = new OdbcCommand("Query...", con);
try
{
    con.Open();
    OdbcReader reader = com.ExecuteReader();

    while(reader.Read())
    {
        //Do things with the results
    }
}
catch(Exception ex)
{
    //Exception handling
}

A lot friendlier than using OleDB I think.

我认为比使用OleDB更友好。