第四題:
今有一 MySQL(MariaDB)資料庫名稱為 BK 之資料表內容如下:
Book 資料表
如何以 C#程式連結此資料庫,MySqlCommand 設定執行 sql 字串時,要計算有幾本書名為 J 開頭的數量及其平均價格的 SQL 字串應該為何?【25 分】
string sql = ???;
MySqlCommand cmd = new MySqlCommand(sql, conn);
int index = cmd.ExecuteNonQuery();
bool success = false;
if (index > 0) success = true; else success = false;
…