I have a question about how to change the web config

Below is my code

<configuration>
	<appSettings/>
	<connectionStrings>
  <add name="MyXT" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\XT.mdf;Integrated Security=True;User Instance=True"
   providerName="System.Data.SqlClient" />
 </connectionStrings>
	<system.web>

If i want to change it from SQL Express to Standard SQL how i have to write about it. Now the data put it on SQL Express and i need to change to SQL.

So wat is the code help me please

Recommended Answers

All 2 Replies

<configuration>
	<appSettings/>
	<connectionStrings>
  <add name="MyXT" connectionString="Data Source=servername;Initial Catalog=dbname;user id=username;password=password"
   providerName="System.Data.SqlClient" />
 </connectionStrings>
	<system.web>

You also use this syntax

For SQL Authentication,

<configuration>
	<appSettings/>
	<connectionStrings>
  <add name="MyXT" connectionString="Database=YourDatabaseName;Server=YourServerName;User Id=UserName;Password=YourPassword"    providerName="System.Data.SqlClient" />
 </connectionStrings>
	<system.web>

For Windows Authentication,

<configuration>
	<appSettings/>
	<connectionStrings>
  <add name="MyXT" connectionString="Database=YourDatabaseName;Server=YourServerName;Integrated Security=True"    providerName="System.Data.SqlClient" />
 </connectionStrings>
	<system.web>

Replace the following information appropriately

YourDatabaseName - Name of the database you want to connect with
YourServerName - Name of the server of PC where the SQL Server instance running
UserName - Name of the SQL server user name(For SQL Authentication only)
YourPassword - Password for the SQL server user name(For SQL Authentication only)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.