因此,我有一個在SQL Server Management Studio中運行的數據庫。將ASP.NET MVC2應用程序連接到SQL Server
在對象資源管理器頂部的服務器信息這樣說:
(本地)(SQL服務器10.0.2531 - 斯科特-PC \斯科特)
如何連接我的ASP.NET MVC2應用到這個實例。我想要一個連接字符串在web.config中,然後我想能夠有一個Database.cs類執行所有存儲的過程和查詢。
因此,我有一個在SQL Server Management Studio中運行的數據庫。將ASP.NET MVC2應用程序連接到SQL Server
在對象資源管理器頂部的服務器信息這樣說:
(本地)(SQL服務器10.0.2531 - 斯科特-PC \斯科特)
如何連接我的ASP.NET MVC2應用到這個實例。我想要一個連接字符串在web.config中,然後我想能夠有一個Database.cs類執行所有存儲的過程和查詢。
Data Source=Scott-PC;Initial Catalog=DatabseName;User Id=Scott;Password=password;
檢查here其他選項
這裏是一個示例...
<connectionStrings>
<add name="ProductionServerEntities"
connectionString="metadata=res://*/Models.MyDBEntityModel.csdl|res://*/Models.MyDBEntityModel.ssdl|res://*/Models.MyDBEntityModel.msl;provider=System.Data.SqlClient;provider connection string="data source=MYSQLSERVER;attachdbfilename=C:\inetpub\domains\MyDomainName\App_Data\MyDB03.mdf;Database=MyDB06;integrated security=False;User ID=sa;Password=MyPassword;multipleactiveresultsets=True;App=EntityFramework""
providerName="System.Data.EntityClient" />
</connectionStrings>