错在哪里了?为什么提示“应用程序在当前操作中使用了错误类型的值”?

wangcw791219 2004-08-13 10:56:47
ADOQuery2.Close;
ADOQuery2.SQL.Clear;
ADOQuery2.SQL.Add('Select * From 进货信息历史表 where '+ComboBox3.Items[ComboBox3.ItemIndex]+' Like :A');
ADOQuery2.Parameters.ParamByName('A').Value :=Edit1.Text+'%';
ADOQuery2.Open;
...全文
466 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
ztenv 2004-08-13
  • 打赏
  • 举报
回复
ADOQuery2.Parameters.ParamByName('A').Value :=quotedstr(Edit1.Text)+'%';//改为:
ADOQuery2.Parameters.ParamByName('A').Value :=quotedstr(Edit1.Text+'%')

wangcw791219 2004-08-13
  • 打赏
  • 举报
回复
单据编号、商品编号、数量是数字类型,问题就出现在数据类型转化上。

ADOQuery2.Parameters.ParamByName('A').Value :=Edit1.Text+'%';
等号左边是数字型,等号右边该怎样写?
wangcw791219 2004-08-13
  • 打赏
  • 举报
回复
再写一次


if (ComboBox3.Items[ComboBox3.ItemIndex]='单据编号') or (ComboBox3.Items[ComboBox3.ItemIndex]='商品编号') or (ComboBox3.Items[ComboBox3.ItemIndex]='数量')
or (ComboBox3.Items[ComboBox3.ItemIndex]='仓库编号') then
begin
ADOQuery2.Close;
ADOQuery2.SQL.Clear;
ADOQuery2.SQL.Add('Select * From 进货信息历史表 where '+ComboBox3.Items[ComboBox3.ItemIndex]+' Like :A');
ADOQuery2.Parameters.ParamByName('A').Value :=quotedstr(Edit1.Text)+'%';
ADOQuery2.Open;
梅青松 2004-08-13
  • 打赏
  • 举报
回复
第一个些错了
试下面两个
wangcw791219 2004-08-13
  • 打赏
  • 举报
回复
上位,我试过不行的。
手指风 2004-08-13
  • 打赏
  • 举报
回复
同意,up!
梅青松 2004-08-13
  • 打赏
  • 举报
回复
或者
ADOQuery2.Parameters.ParamByName('A').Value := '''' + Edit1.Text+ '%'' ';
梅青松 2004-08-13
  • 打赏
  • 举报
回复
ADOQuery2.Parameters.ParamByName('A').Value := '''' + Edit1.Text+ '%' + '''';
梅青松 2004-08-13
  • 打赏
  • 举报
回复
ADOQuery2.Parameters.ParamByName('A').Value := '''' + Edit1.Text+'%'''';

2,498

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 数据库相关
社区管理员
  • 数据库相关社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧