Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i want to deploy my website but my project in vs2012 with db so i am trying to deploy database error occur when i am deploy my site in server?

my db is local bt when in server the db connection problem occurs
Posted
Comments
KaushalJB 14-Oct-14 2:34am    
What is the exact error that occurs.. ? Provide what steps you did while deploying so your question can be clear
Sandy W 14-Oct-14 7:45am    
c:.../../ some path is display

Hi,
The system which is handling the database should have an internet connection so that the server in which the site is being deployed will access the db through internet/Lan and the site will be accessed. In the web config connection string just provide the details that u genetally try to open the sql. try this and let me know the result.Please provide the Ip appdress in the ConnectionString of the web config
 
Share this answer
 
v2
Comments
Sandy W 14-Oct-14 5:59am    
hay i am use |DataDirectory| for connection ..
Sandy W 14-Oct-14 6:46am    
hay jing plz help properly
jing567 15-Oct-14 2:22am    
Please check my suggested solution in the below format...
Can you paste your code here? Coonection string must be in config file.
You needs to change your local db path with server IP in connection string.
 
Share this answer
 
Comments
Sandy W 14-Oct-14 6:00am    
how local db path with server IP in connection string ?
Sandy W 14-Oct-14 7:48am    
<configuration>
<connectionstrings>
<add name="ApplicationServices" connectionstring="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" providername="System.Data.SqlClient">


my connection string... plz help
|DataDirectory| does not come from config settings;

ConfigurationManager.AppSettings["DataDirectory"]


This comes from config settings; a .config file you have to create and put into your project. This particular setting is the value of the element with key "DataDirectory" in the AppSettings element. This doesn't exist unless you put one in the .config file. Typically this is where you put configuration or startup data that is never changed. You should not put file paths here, as they can be different on the machine users install your database to.

Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)


This is the path to the current user's roaming application data folder defined by the operating system your app was installed on. You cannot change this, it is defined by the OS. You can be sure this folder is writable by the user, and will be available if the user roams, or logs on from another machine. This is typically where you want to put editable user data.

SqlConnection("Data Source=|DataDirectory|\\DatabaseFileName.sdf;...")


This is a connection string for an ADO.NET connection. ADO.NET treats vertical bars specially, it looks for an AppDomain data matching the key name between the vertical bars. You can get the same data with:

AppDomain.CurrentDomain.GetData("DataDirectory")
 
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