select * from table1 where outday between datevalue(edit1.text) and datevalue(edit2.text);
1、ExtractFilePath(Application->ExeName) 即可得到当前路径。 2、AnsiString sql="select * from table1 where outday between :val1 and :val2"; Query1->SQL->Add(sql); Query1->ParamByName("val1")->AsString=edit1.text; Query1->ParamByName("val2")->AsString=edit2.text; Query1->Open();
1.当前路径可通过API函数获得。 2.首先你应该将edit1.text、 edit1.text 转换成'2001-01-01'格式(使用Format 函数) 然后比较。SQLStr := 'select * from table1 where outday between ''s1'' and ''s2''';
2、AnsiString sql="select * from table1 where outday between :val1 and :val2";
Query1->SQL->Add(sql);
Query1->ParamByName("val1")->AsString=edit1.text;
Query1->ParamByName("val2")->AsString=edit2.text;
Query1->Open();
2.首先你应该将edit1.text、 edit1.text 转换成'2001-01-01'格式(使用Format 函数) 然后比较。SQLStr := 'select * from table1 where outday between ''s1'' and ''s2''';