KVADODBGrid控件提供多條件查詢功能,即控件方法SetSqlStringWhere(STRING bstrWhere1,STRING bstrWhere2,STRING bstrWhere3,STRING bstrWhere4,STRING bstrWhere5,STRING bstrWhere6);
下面以查詢報警數據庫為例:
string whe1;
string whe2;
string whe3;
whe1="AlarmDate='"+\本站點查詢日期+"' and VarName='數據1'";
whe2=" or AlarmDate='"+\本站點查詢日期+"' and VarName='數據2'" ;
whe3=" or AlarmDate='"+\本站點查詢日期+"' and VarName='數據3'" ;
ctrl.SetSqlStringWhere(whe1,whe2,whe3," "," "," ");//可以最多寫六個條件,用不到的就用" "代替。
ctrl.FetchData();
ctrl.FetchEnd();