這是備份網站。主網站位於http://www.dotblogs.com.tw/mis2000lab/ MIS2000 Lab's ASP.NET & Linux (Trad. Chinese 正體中文;Big5)。這個網站,是我們(MIS2000 Lab.資訊工作室)多年教學的實際心得與上課範例,有ASP.NET程式設計,也有Linux的相關文件。
編輯。 您也可以直接參觀主網站
MIS2000 Lab. is MVP 2008-2017/7/1 for ASP/ASP.NET.
System.Data. While the base layer is already part of .NET Core, i.e. the provider model and SQL client, some features are currently notavailable, such as schema support and DataTable/DataSet.
System.Transactions. While ADO.NET supports transactions, there is no support for distributed transactions, which includes the notion of ambient transactions and enlistment. (您可以參閱我這本書 -- 深入探索 .NET資料存取:ADO.NET + SqlDataSource+ LINQ (松崗),有討論 System.Transaction)
System.Net.Mail. There is currently no support for sending emails from .NET Core using these APIs.
var Conn = new SqlConnection(connectionString);
Conn.Open();
//重點!參數的寫法!!
var Com = new SqlCommand("Select title from test Where id = @ID", Conn);
Com.Parameters.AddWithValue("ID", 3); // 您要分開寫成 .Add()方法與 Value屬性,也是可以運作的,跟以前的寫法雷同
using (SqlDataReader dr = Com.ExecuteReader())
{
while (dr.Read())
{ // (1). 中文亂碼的解決 -- 瀏覽器的編碼,請改成 UTF-8
var title = dr["title"];
await context.Response.WriteAsync("
" + title + "
");
}
}
Conn.Close();
第二,讀出的數據,在瀏覽器上面變成亂碼 (啥!? 中文亂碼問題)
這裡也很傷腦筋。
有兩種方法可以解決。
*** 一個是在 User (Client端)的瀏覽器上,重新設定「編碼」,例如改成UTF-8就能解決。