StringBuilder sb = new StringBuilder(); var testNo = 100; MySqlConnection conn = MysqlFactory.GetConnection(); DateTime curr = DateTime.Now; string sql = "SELECT merno1,mername,price,ezdesc FROM shmeritem"; for (var i = 0; i < testNo; i++) { try { conn.Open(); MySqlCommand cmd = new MySqlCommand(sql, conn); List結果list = new List (); var dr = cmd.ExecuteReader(); while (dr.Read()) { list.Add(new MernoDetailValue() { Merno1 = dr.GetString("merno1"), MerName = dr.GetString("mername"), Price = dr.GetDecimal("price"), EzDesc = dr.GetString("ezdesc") }); } } finally { conn.Close(); } } sb.AppendFormat("{0}s\n", (DateTime.Now - curr).TotalSeconds); curr = DateTime.Now; for (var i = 0; i < testNo; i++) { try { conn.Open(); MySqlCommand cmd = new MySqlCommand(sql, conn); DataTable dt = new DataTable(); MySqlDataAdapter mda = null; mda = new MySqlDataAdapter(cmd); mda.Fill(dt); } finally { conn.Close(); } } sb.AppendFormat("{0}s\n", (DateTime.Now - curr).TotalSeconds);
37.1417164s
37.6632826s
ExecuteReader略快一點