开发者

Strange code construction for ADODB.Connection Open

We're reviewing the code of Classic ASP application. In the code that we're reviewing we see the following string:

Dim con as new ADODB.Connection
con.Open "SomeName"
...

The project ASP files are stored in the project folder root and the App_Data contains the file SomeName.mdb

We didn't get any guidelines about any additional data sources set up or some application settings, and when the con.Open "SomeName" is called - it crashes. What should be done s开发者_StackOverflowo the con.Open "SomeName" would actually open the \App_Data\SomeName.mdb?


It is possible that SomeName is an ODBC data source.

Try replacing it with:

"DRIVER={Microsoft Access Driver (*.mdb)};DBQ=App_Data\SomeName.mdb;"


Ok. Got it. If you will create the DSN with such name "SomeThing", the con.Open "SomeThing" will normally find it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜