我正在研究一个新的asp.net web应用程序,它必须连接并使用旧的旧数据库。它不像SQL Server那样是RDBMS,而是C-Treive,所以我应该使用ODBC或在我的C#/ ASP代码中。我将使用这个命名空间:Web.Config中非关系数据库(遗留)的连接字符串设置
System.Data.Odbc;
现在,我的问题是在Web.Config文件。我多年没有使用ODBC,每次运行应用程序时都会抛出一个错误,指出它是无效的连接。
` add name =“DB_Connection”connectionString =“Driver = ODBCDriver; server = 172.xxx.xxx.xxx;”的providerName = “System.Data.Odbc”/>
internal OdbcConnection OpenConnection()
{
OdbcConnection conn = new OdbcConnection(ConnectionString);
conn.Open();
return conn;
}
`
{“ERROR [IM002] [微软] [ODBC驱动程序管理器]数据源名称不 发现默认驱动程序指定“}
这是我在Web.Config中宣布:
老实说,我不确定在这种情况下会被视为Catalog,因为它不是SQL Server。
我会感激你的意见。
感谢, 阿米特
什么是'ConnectionString'。需要那个。 – Zer0
这是我用过的,并且在标签下的web.config文件中没有帮助:'add name =“DB_Connection”connectionString =“Driver = ODBCDriver; server = 172.xxx.xxx.xxx;” providerName =“System.Data.Odbc”/>' –