select * from db.mdb where (cast(number as integer) between '+edit1.text+' and '+edit2.text+')')
解决方案 »
- 若Excel中的单元格的内容是个公式,如何取得该公式的结果而不是公式本身
- 《资料管理专家》,瑞星一样的界面,风格独特,功能强大?
- 这个MSDN是不是常说的那个MSDN资料库?
- 关机的问题
- delphi中能不能调用外部的dll(vc++的),如果能,该怎么办??
- 如何调用由vc++做的dll?将dll放在何处?
- 远程登陆,避免密码,怎么设置??
- PageContral标签在左侧时,标签中的文字自从下,怎样使其从左到右
- 使用TDCOMConnection组件时如何注册?
- 窗体间共享变量
- 高手请帮忙:如何使用nmsmtp控件发送带附件的HTML格式信件
- 用delphi写程序,有时出现语法错误实在是难发现,难修改,有没有好的办法优化解决呢?
query1.ParamByName(x).asinteger := strtoint(edit1.text);
query1.ParamByName(y).asinteger := strtoint(edit2.text);
query1.sql.add(ssql);
query1.parambyname('x').asinteger:=strtoint(edit1.text);
query1.ParamByName('y').asinteger := strtoint(edit2.text);
你的number好象是个字符串类型的,
你要给它加引号才可以啊!
这种情况可以写成select * from db.mdb where number between '+#39+edit1.text+#39+' and '+#39+edit2.text+#39+',因为是字符型,所以你必须要加引号!
怎么定义CAST啊???????????
Converts specified value to the specified data type.CAST(column_reference AS data_type)DescriptionUse CAST to convert the value in the specified column to the data type specified. CAST can also be applied to literal and calculated values. CAST can be used in the columns list of a SELECT statement, in the predicate for a WHERE clause, or to modify the update atom of an UPDATE statement.The Data_Type parameter may be one of most column data type applicable to the table type used: CHAR, INTEGER, NUMERIC, and so on. Certain column types cannot be used as the source or target data types: BLOB, MEMO, and BYTES.The statement below converts a Paradox TIMESTAMP column value to DATE.SELECT CAST(SaleDate AS DATE)FROM ORDERSConverting a column value with CAST allows use of other functions or predicates on an otherwise incompatible data type, such as using the SUBSTRING function on a DATE column.SELECT SaleDate, SUBSTRING(CAST(CAST(SaleDate AS DATE) AS CHAR(10)) FROM 1 FOR 1)FROM OrdersWhen applied to retrieved data of a SELECT statement, the effect is transient and does not affect stored data. When applied to the update atoms of an UPDATE statement, the effect is persistent and permanently converts the case of the stored values.Note: the CAST function cannot be used with memo or BLOB columns.
另外你当字符串用不也行吗 '026' 当然应比 '025'大了,转换做什么
'select * from db.mdb where number>'''+Edit1.Text+'''and number<'''+Edit2.Text+'''';