ASP .NET Web配置文件设置 [英] ASP .NET WEB CONFIG FILE SETTING
问题描述
我在使用asp .net时遇到问题.我想在我的项目中使用MS asscess文件,在我的Web文件夹〜/App_data/myfile.mdb
中使用文件
当我尝试打开此文件时.我收到消息无效路径.
但是我正在看我的程序在c:\ ... \ ... \ ... \ myfie.mdb中.
这是不正确的路径.
我的oledb代码如下
myCon =新的OleDbConnection(@"Provider = Microsoft.Jet.OLEDB.4.0;用户ID =;密码=;数据源= TFMdb.mdb");
任何人都可以帮助我如何在Web config.file中定义路径吗?
I am having problem working with asp .net. I want to use MS asscess file in my project my file in my web folder ~/App_data/myfile.mdb
when I trying to open this file. I am getting message Invalid path.
but I am looking my program looking in c:\...\...\...\myfie.mdb.
which is not correct path.
my oledb code is as follow
myCon = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0; User Id=; Password=; Data Source= TFMdb.mdb");
Can any one help me to how to define path in web config.file please
推荐答案
在web.config文件中使用它.
Use this in web.config file.
<connectionStrings>
<add name="conAccess" connectionString="Provider=microsoft.jet.oledb.4.0;data source=|DataDirectory|\Database1.mdb" />
</connectionStrings>
这篇关于ASP .NET Web配置文件设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!