문제

I have recently created an asp.net page in visual studio 2010. I have not changed any of the prebuilt loginview code. It creates the MDF file that allows for logging in users and registering users. However, I don't want to use the MDF file, I want to use a SQL Server instance i have running (lets call it MyServer) with a database MyDatabase. Where is the code that connects to the MDF file and is there a clean way of changing the data source? Thanks!

도움이 되었습니까?

해결책

You can modify your string connection in your config file (Web.config)

Modify this section

<connectionStrings>
   <add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=../File.mdf; Integrated Security=True;Connect Timeout=30;User Instance=True;Trusted_Connection=Yes"/>
</connectionStrings>

With for example this

<connectionStrings>
<add name="ConnectionString" connectionString="Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI;"/>
</connectionStrings>

Link : http://www.connectionstrings.com/

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top