Click here to Skip to main content
15,890,690 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi there,

i try to set database path in web.config file.

i am using file zilla for upload files.
Database file in App_data folder.

i used following code:

XML
<add name="conn" connectionstring="Data Source=localhost;Initial Catalog=|DataDirectory|\KesariyaData.mdf;pooling='true';Integrated Security=True;User Instance=True" />



Above code display error.

Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed.
Posted
Updated 23-Jan-14 18:55pm
v3

HTML
 This might be helpful for you..
<connectionstrings>
   <add name="conn" connectionstring="Data Surce=|DataDirectory|KesariyaData.sdf">
    providerName="System.Data.SqlServerCe.4.0"/>
 </add></connectionstrings>
 
Share this answer
 
v2
In Web.config

<add name="irtConnString" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" providerName="System.Data.OleDb"/>



Code:
C#
<pre>string connectionString = ConfigurationManager.ConnectionStrings["irtConnString"].ConnectionString + Server.MapPath("/your/application/path/irtDB.mdb");
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900