顯然沒有人將可視化Web開發表達式與數據庫連接起來,因爲我無法在Google上找到任何有用的東西。ASP.NET數據庫選項
- 我是否需要將數據源連接到我的項目,以便登錄控制/ etc工作?如果沒有,還有其他什麼?
- 什麼(免費!)數據庫可以用作視覺Web開發中的數據源表達?
- 我該如何連接它們?
我的問題有點短,但我得走了,在此先感謝。
顯然沒有人將可視化Web開發表達式與數據庫連接起來,因爲我無法在Google上找到任何有用的東西。ASP.NET數據庫選項
我的問題有點短,但我得走了,在此先感謝。
答案就在這裏Using the Web.Config to set up my SQL database connection string?
這就是你所需要的!
UPDATE
一個小例子: 首先參考System.Configuration添加到您的項目,然後進口在你的代碼(使用System.Configuration)。
DataSet ds = new DataSet(); //Create a DataSet
string ConnectionString = ConfigurationManager.ConnectionStrings["YourConnectionStringName"].ConnectionString; //ConnectionString from web.config
SqlConnection con = new SqlConnection(); //Create a new SqlConnection
con.ConnectionString = ConectionString; //Connect using your ConnectionString
SqlDataAdapter da = new SqlDataAdapter("Your SQL query goes here", con); //Get Data
da.Fill(ds); //Fill a DataSet (in this case)
con.Close(); //Close connection
是的,ASP.NET內置的Membership功能使用數據庫來存儲他們的信息。
堅持與微軟的數據庫?
的SQL Server Express: http://www.microsoft.com/express/Database/
的SQL Server Compact 4.0: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=033cfb76-5382-44fb-bc7e-b3c8174832e2
取決於你如何進行數據存取,但你會通過構建一個連接字符串啓動。
好的,我有一個連接字符串,但我該怎麼辦呢?我已經將它添加到web.config下,但是如何告訴VWD使用並連接到它? –
Dan
2011-04-28 21:11:43
我希望我的更新可以幫助你 – christiangobo 2011-04-29 15:20:40