I am totally new to .NET VB, I have this code in Web.config:
<connectionStrings>
<add name="myDBConnectionString" connectionString="Data Source=storage\webdb;Initial Catalog=myWebDB;Integrated Security=True"
providerName="System.Data.SqlClient"/>
</connectionStrings>
I want to know where is the database saved? how can I edit my database directly?
Related
When I click the Security tab on the ASP.NET Web Site Administration Tool, I get this error.
"Unable to connect to SQL Server database.".
I'm using Visual Studio 2012
<configuration>
<connectionStrings>
<add name="devices" connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\devices.mdf;Integrated Security=True"
providerName="System.Data.SqlClient" />
<add name="users" connectionString="Data Source=(LocalDB)\v11.0;AttachDbfilename=|DataDirectory|\database.mdf;Integrated Security=True"
providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<roleManager enabled="true" />
<compilation debug="true" targetFramework="4.5"/>
<httpRuntime targetFramework="4.5"/>
</system.web>
</configuration>
Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\devices.mdf;Integrated Security=True
Looking at your data source. Does (LocalDB)\v11.0 exist and can you connect to the above DB?
If not that will be the reason....
I have found that every time I create a package for my website (For manual deployments), it overwrites my connection string in the package being created with the above data source.
This can be a blessing some times preventing your new website from launching. (Especially if its in the wrong environment. :)
http://www.connectionstrings.com/ This site is great for helping you creating connection strings for almost any DB.
I added database file to my built in sql server of Visual Studio and i have also connection string of it but i am confuse how to add this connection string into web.config
here is my try to add connection string to code below :
<connectionStrings>
<add name="myFirstConnectionString" connectionString="Data Source= .\SQLEXPRESS;AttachDbFilename="C:\Users\Ahdus\Desktop\First Task\First Task\MyFirstTask.mdf"; Integrated Security=True;Connect Timeout=30;User Instance=TrueproviderName="System.Data.SqlClient" />
</connectionStrings>
I am much confused that how i can add connection string of my visual studio built in database file to web.config.
Please help me as i am new in asp.net and ignore my way of asking.
To make your connection string work with the path you've given, it should look somewhat like this:
Visual Studio 2012 (SQL Server 2012):
<connectionStrings>
<add name="myFirstConnectionString"
connectionString="Data Source=(LocalDB)\v11.0;Integrated Security=True;AttachDBFilename="C:\Users\Ahdus\Desktop\First Task\First Task\MyFirstTask.mdf";Integrated Security=True"
providerName="System.Data.SqlClient"/>
</connectionStrings>
Visual Studio 2010 (SQL Server 2010):
<connectionStrings>
<add name="myFirstConnectionString"
connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename="C:\Users\Ahdus\Desktop\First Task\First Task\MyFirstTask.mdf";User Instance=true"
providerName="System.Data.SqlClient" />
</connectionStrings>
But you should consider moving the database file to the App_Data folder in your project, and then use AttachDBFilename=|DataDirectory|MyFirstTask.mdf instead.
You should place you .mdf in App_Data folder, then you can use this
<connectionStrings>
<add name="myFirstConnectionString"
connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|MyFirstTask.mdf;
User Instance=true" providerName="System.Data.SqlClient" />
</connectionStrings>
With C:\Users\Ahdus\Desktop\First Task\First Task\MyFirstTask.mdf, if you move your application to another machine, that path might not exist
|DataDirectory| maps to your application App_Data folder
When you create a new ASP.NET project with membership it creates the default connection string for ApplicationServices as follows:
<add name="ApplicationServices"
connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true"
providerName="System.Data.SqlClient" />
Is there a way to force this to use SqlServerCe in the App_Data folder instead of creating it in sql express?
no its not possible, but you can check it via code for data source..
Hello i want to transfer my web application to the remote server, this is my local web.config file, can someone pls help me with this? I am using godaddy.I know i have to use the remove .. but i don't know how to do it using visual studio 2010. I am also confuse with the add name="applicationservices". in visual studio 2005 its <add name="LocalSqlServer"
Please i need help and clarification
<connectionStrings>
<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true"
providerName="System.Data.SqlClient" />
<add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
1: You need to upload your database to your server.
2: Use godaddy's functionality to attach that database to their SqlServer.
3: Adjust your connectionstring to point to the DB on godaddy's server. You will have to ask them for the format.
4: Adjust your web.config.
Check if this helps:
Ok so I am using forms authentication in my web site and I defined this in my config. Therefore I have an ASPNETDB.MDF. So do I need to have a database called ASPNETDB.MDF in my web host? If that is the case then how do I connect this so that my site uses this to verify users? I am sorry this seems to be like a very noob question
Place the ASPNETDB.MDF in your App_Data folder.
The connection string to use is <add name="LocalSqlServer" connectionString="Data Source=.\SQLExpress;Integrated Security=True;User Instance=True;AttachDBFilename=|DataDirectory|aspnetdb.mdf" />
When you hook this connection string to your membership provide the authentication will use your ASPNETDB.MDF file.
-------------------Try the following-----------------
Sorry place a above the connection string above you should be able to change the name of the connection string. You will also need to change this in your membership element.
<connectionStrings>
<clear />
<add name="NewConnectionString" connectionString="Data Source=.\SQLExpress;Integrated Security=True;User Instance=True;AttachDBFilename=|DataDirectory|aspnetdb.mdf" providerName="System.Data.SqlClient" />
</connectionStrings>
<membership>
<providers>
<clear/>
<add name="AspNetSqlMembershipProvider"
connectionStringName="NewConnectionString"
...
type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</membership>
You dont have to use a database to use forms authentication, you can define the entries in the web.config file if you like. It depends on the MembershipProvider that you are using.
Have a look here for an example