我正在开发一个查询个人电影数据库的程序。计划的难点在于选择流派。例如,假设我有 3 个复选框动作、冒险和喜剧。一部电影可能属于一种类型或多种类型。电影可以是动作片或动作/喜剧。
下面的代码片段是我开始的......但不适应所有的变化。Fill_Grid 函数填充一个dataGridView。如果电影具有一种流派,或者用户选择的电影与数据库中的流派完全相同,它就可以工作。需要发生的是,如果电影是动作喜剧,那么它应该在用户选择仅动作或仅喜剧或动作和喜剧时显示。
如果这没有意义,请提出问题。
在此先感谢,-J
string str_SQL = "SELECT Name, File, Action, Fantasy, Horror, Thriller, Adventure, Animation, Comedy, Crime, Documentary, Drama, Family, Games, Mystery, Romance, SciFi, War FROM tbl_Main WHERE Action = " + chk_Action.Checked +
" AND Fantasy = " + chk_Adv.Checked +
" AND Horror = " + chk_Hor.Checked +
" AND Thriller = " + chk_Thrill.Checked +
" AND Adventure = " + chk_Adv.Checked +
" AND Animation = " + chk_Anim.Checked +
" AND Comedy = " + chk_Com.Checked +
" AND Crime = " + chk_Crime.Checked +
" AND Documentary = " + chk_Doc.Checked +
" AND Drama = " + chk_Drama.Checked +
" AND Family = " + chk_Fam.Checked +
" AND Games = " + chk_Game.Checked +
" AND Mystery = " + chk_Mys.Checked +
" AND Romance = " + chk_Rom.Checked +
" AND SciFi = " + chk_Sci.Checked +
" AND War = " + chk_War.Checked + ";";
Fill_Grid(str_SQL);