2011-12-30 275 views
1

連接字符串的應用程序的設置來連接SQLSERVER Express數據庫,以及如何利用該數據庫的建立與我的申請.....數據庫連接,並與數據庫

+3

http://www.connectionstrings.com/sql-server-2008 – SQLMenace 2011-12-30 12:03:42

+0

你是什麼意思「如何利用該數據庫的建立與我的應用程序......」? – aProgrammer 2011-12-30 12:07:17

回答

0

下面的片段應該讓你開始。

SQLConnectionStringBuilder bldr = new SQLConnectionStringBuilder   
    bldr.DataSource = "Server" //Put your server or server\instance name here. Likely YourComputerName\SQLExpress   
    bldr.InitialCatalog = "MyDB" //The database on the server that you want to connect to.   
    bldr.UserID = "SomeUser" //The user id   
    bldr.Password = "SomePassword" //The pwd for said user account 
SQLConnection myConnection = new SQLConnection(bldr.ConnectionString)