if lkform.RadioButton1.checked=true and radiobutton1.checked=true then
begin
adoquery1.Close;
adoquery1.sql.Clear;
adoquery1.sql.Add('update suppy_info');
adoquery1.sql.Add('set suppy_number=suppy_number+'-lkform.edit3.text+edit3.text);
adoquery1.sql.Add('from suppy_info,jc_details');
//sql.Add('where jc_details.jc_state=''进''');
adoquery1.sql.Add('and suppy_info.suppy_id='+''''+edit1.Text+'''');
adoquery1.execsql;
end;
if lkform.RadioButton2.checked=true and radiobutton2.checked=true then
begin
adoquery1.Close;
adoquery1.sql.Clear;
adoquery1.sql.Add('update suppy_info');
adoquery1.sql.Add('set suppy_number=suppy_number+'+lkform.edit3.text-edit3.text);
adoquery1.sql.Add('from suppy_info,jc_details');
adoquery1.sql.Add('and suppy_info.suppy_id='+''''+edit1.Text+'''');
adoquery1.execsql;
end;
if lkform.RadioButton1.checked=true and radiobutton2.checked=true then
begin
adoquery1.Close;
adoquery1.sql.Clear;
adoquery1.sql.Add('update suppy_info');
adoquery1.sql.Add('set suppy_number=suppy_number+'-lkform.edit3.text-edit3.text);
adoquery1.sql.Add('from suppy_info,jc_details');
adoquery1.sql.Add('and suppy_info.suppy_id='+''''+edit1.Text+'''');
adoquery1.execsql;
end;
if lkform.RadioButton2.checked=true and radiobutton1.checked=true then
begin
adoquery1.Close;
adoquery1.sql.Clear;
adoquery1.sql.Add('update suppy_info');
adoquery1.sql.Add('set suppy_number=suppy_number+'+lkform.edit3.text+edit3.text);
adoquery1.sql.Add('from suppy_info,jc_details');
adoquery1.sql.Add('and suppy_info.suppy_id='+''''+edit1.Text+'''');
adoquery1.execsql;
end;
错误提示:Build
[Error] Unit4.pas(146): Operator not applicable to this operand type
[Error] Unit4.pas(157): Operator not applicable to this operand type
[Error] Unit4.pas(167): Operator not applicable to this operand type
[Error] Unit4.pas(167): Operator not applicable to this operand type
[Fatal Error] Project1.dpr(8): Could not compile used unit 'Unit4.pas'
begin
adoquery1.Close;
adoquery1.sql.Clear;
adoquery1.sql.Add('update suppy_info');
adoquery1.sql.Add('set suppy_number=suppy_number+'-lkform.edit3.text+edit3.text);
adoquery1.sql.Add('from suppy_info,jc_details');
//sql.Add('where jc_details.jc_state=''进''');
adoquery1.sql.Add('and suppy_info.suppy_id='+''''+edit1.Text+'''');
adoquery1.execsql;
end;
if lkform.RadioButton2.checked=true and radiobutton2.checked=true then
begin
adoquery1.Close;
adoquery1.sql.Clear;
adoquery1.sql.Add('update suppy_info');
adoquery1.sql.Add('set suppy_number=suppy_number+'+lkform.edit3.text-edit3.text);
adoquery1.sql.Add('from suppy_info,jc_details');
adoquery1.sql.Add('and suppy_info.suppy_id='+''''+edit1.Text+'''');
adoquery1.execsql;
end;
if lkform.RadioButton1.checked=true and radiobutton2.checked=true then
begin
adoquery1.Close;
adoquery1.sql.Clear;
adoquery1.sql.Add('update suppy_info');
adoquery1.sql.Add('set suppy_number=suppy_number+'-lkform.edit3.text-edit3.text);
adoquery1.sql.Add('from suppy_info,jc_details');
adoquery1.sql.Add('and suppy_info.suppy_id='+''''+edit1.Text+'''');
adoquery1.execsql;
end;
if lkform.RadioButton2.checked=true and radiobutton1.checked=true then
begin
adoquery1.Close;
adoquery1.sql.Clear;
adoquery1.sql.Add('update suppy_info');
adoquery1.sql.Add('set suppy_number=suppy_number+'+lkform.edit3.text+edit3.text);
adoquery1.sql.Add('from suppy_info,jc_details');
adoquery1.sql.Add('and suppy_info.suppy_id='+''''+edit1.Text+'''');
adoquery1.execsql;
end;
错误提示:Build
[Error] Unit4.pas(146): Operator not applicable to this operand type
[Error] Unit4.pas(157): Operator not applicable to this operand type
[Error] Unit4.pas(167): Operator not applicable to this operand type
[Error] Unit4.pas(167): Operator not applicable to this operand type
[Fatal Error] Project1.dpr(8): Could not compile used unit 'Unit4.pas'
解决方案 »
- Delphi 动态创建的窗体间如何传值?
- 如何获取局域网映射盘中文件的绝对路径?
- 如何更改数据集中行的更新状态?
- 怎样对一般用户进行写入操作
- 关于message消息
- 请问高手 做分层的IMAGE 如何做 如何动态捕捉用CANVAS画的线条 就是如何选中单个的 像PHOTOSHOP里的层的概念差不多
- -------100分求助﹗關于QuickReport設定打印起始與終止頁的問題--------
- CXGrid用法
- 请教:怎样记录下,所以程序中的击键动作?
- 能给48分,我全给了!关于怎么比较两个查询结果集的问题!
- 求助:求在放大图上进行画图操作的思路
- @string 和pchar(string) 区别
不能有减号,字符串可以用+好连接但是不能用 - 号减,- 号使用有问题
begin
adoquery1.Close;
adoquery1.sql.Clear;
adoquery1.sql.Add('update suppy_info');
adoquery1.sql.Add('set suppy_number=suppy_number+'+inttostr(strtoint(edit3.text)-strtoint(lkform.edit3.text))+' ');
adoquery1.sql.Add('from suppy_info,jc_details');
//sql.Add('where jc_details.jc_state=''进''');
adoquery1.sql.Add('and suppy_info.suppy_id='+''''+edit1.Text+'''');
adoquery1.execsql;
end;
if lkform.RadioButton2.checked=true and radiobutton2.checked=true then
begin
adoquery1.Close;
adoquery1.sql.Clear;
adoquery1.sql.Add('update suppy_info');
adoquery1.sql.Add('set suppy_number=suppy_number+'+inttostr(strtoint(lkform.edit3.text)-strtoint(edit3.text)));
adoquery1.sql.Add('from suppy_info,jc_details');
adoquery1.sql.Add('and suppy_info.suppy_id='+''''+edit1.Text+'''');
adoquery1.execsql;
end;
//后面的用类似的方法改掉
还有4个:
adoquery1.sql.Add('from suppy_info,jc_details');
adoquery1.sql.Add('and suppy_info.suppy_id='+''''+edit1.Text+''''); 这里边实际上相当于这样:adoquery1.sql.Add('from suppy_info,jc_details and suppy_info.suppy_id='+''''+edit1.Text+'''');
语法不通吧?
if lkform.RadioButton2.checked=true and radiobutton2.checked=true then
if lkform.RadioButton1.checked=true and radiobutton2.checked=true then
if lkform.RadioButton2.checked=true and radiobutton1.checked=true then
这些都错了,要加上括号,True可以省略去...if (lkform.RadioButton1.checked) and (radiobutton1.checked) then
if (lkform.RadioButton2.checked) and (radiobutton2.checked) then
if (lkform.RadioButton1.checked) and (radiobutton2.checked) then
if (lkform.RadioButton2.checked) and (radiobutton1.checked) then
if lkform.RadioButton2.checked=true and radiobutton2.checked=true then
if lkform.RadioButton1.checked=true and radiobutton2.checked=true then
if lkform.RadioButton2.checked=true and radiobutton1.checked=true then
这些都错了,要加上括号,True可以省略去...if (lkform.RadioButton1.checked) and (radiobutton1.checked) then
if (lkform.RadioButton2.checked) and (radiobutton2.checked) then
if (lkform.RadioButton1.checked) and (radiobutton2.checked) then
if (lkform.RadioButton2.checked) and (radiobutton1.checked) then
改成
if lkform.RadioButton1.checked and radiobutton1.checked then
if (lkform.RadioButton1.checked) and (radiobutton1.checked) then
if (lkform.RadioButton2.checked) and (radiobutton2.checked) then
if (lkform.RadioButton1.checked) and (radiobutton2.checked) then
if (lkform.RadioButton2.checked) and (radiobutton1.checked) then 用了2楼同志的改了,也还是错滴~~~~~~`我个人觉得: 错误应该在这边:adoquery1.sql.Add('set suppy_number=suppy_number+'-lkform.edit3.text-edit3.text);提示的错误: [Error] Unit4.pas(167): Operator not applicable to this operand type
[Fatal Error] Project1.dpr(8): Could not compile used unit 'Unit4.pas'
adoquery1.sql.Add('set suppy_number=suppy_number+'+lkform.edit3.text-edit3.text);
adoquery1.sql.Add('from suppy_info,jc_details');
adoquery1.sql.Add('and suppy_info.suppy_id='+''''+edit1.Text+''''); 执行之后应该是(注意红色部分):
ADOQuery1.SQL.Text=''update suppy_info set suppy_number=suppy_number+'+lkform.edit3.text-edit3.text from suppy_info,jc_details and suppy_info.suppy_id='''+edit1.Text+'''';
这里似乎少了一个Where关键字;
还有:
suppy_number=suppy_number+'+lkform.edit3.text-edit3.text
这一句引号外边应该返回的是数字型,那么:
suppy_number=suppy_number+'+IntToStr(StrToInt(lkform.edit3.text-StrToInt(lkform.edit3.text))
试着修改上边两处地方后再执行
if () AND () then
if (lkform.RadioButton1.checked=true) and (radiobutton1.checked=true) then
begin
adoquery1.Close;
adoquery1.sql.Clear;
adoquery1.sql.Add('update suppy_info');
adoquery1.sql.Add('set suppy_number=suppy_number+'+ IntToSr(StrToInt(edit3.text)-StrToInt(lkform.edit3.text)));
adoquery1.sql.Add('from suppy_info,jc_details');
//sql.Add('where jc_details.jc_state=''进''');
adoquery1.sql.Add('and suppy_info.suppy_id='+''''+edit1.Text+'''');
adoquery1.execsql;
end;
if (lkform.RadioButton2.checked=true) and (radiobutton2.checked=true) then
begin
adoquery1.Close;
adoquery1.sql.Clear;
adoquery1.sql.Add('update suppy_info');
adoquery1.sql.Add('set suppy_number=suppy_number+'+ IntToSr(StrToInt(lkform.edit3.text)-StrToInt(edit3.text)));
adoquery1.sql.Add('from suppy_info,jc_details');
adoquery1.sql.Add('and suppy_info.suppy_id='+''''+edit1.Text+'''');
adoquery1.execsql;
end;
if (lkform.RadioButton1.checked=true) and (radiobutton2.checked=true) then
begin
adoquery1.Close;
adoquery1.sql.Clear;
adoquery1.sql.Add('update suppy_info');
adoquery1.sql.Add('set suppy_number=suppy_number-'+ IntToSr(StrToInt(lkform.edit3.text)+StrToInt(edit3.text)));
adoquery1.sql.Add('from suppy_info,jc_details');
adoquery1.sql.Add('and suppy_info.suppy_id='+''''+edit1.Text+'''');
adoquery1.execsql;
end;
if (lkform.RadioButton2.checked=true) and (radiobutton1.checked=true) then
begin
adoquery1.Close;
adoquery1.sql.Clear;
adoquery1.sql.Add('update suppy_info');
adoquery1.sql.Add('set suppy_number=suppy_number+'+ IntToSr(StrToInt(lkform.edit3.text)+StrToInt(edit3.text)));
adoquery1.sql.Add('from suppy_info,jc_details');
adoquery1.sql.Add('and suppy_info.suppy_id='+''''+edit1.Text+'''');
adoquery1.execsql;
end;
var
S: string; //定义一个变量吧
begin
S := '';
if lkform.RadioButton1.checked = true and radiobutton1.checked = true then
S := Format('set suppy_number=suppy_number-%s+%s', [lkform.edit3.text, edit3.text]);
if lkform.RadioButton2.checked = true and radiobutton2.checked = true then
S := Format('set suppy_number=suppy_number+%s-%s', [lkform.edit3.text, edit3.text]);
if lkform.RadioButton1.checked = true and radiobutton2.checked = true then
S := Format('set suppy_number=suppy_number-%s-%s', [lkform.edit3.text, edit3.text]);
if lkform.RadioButton2.checked = true and radiobutton1.checked = true then
S := Format('set suppy_number=suppy_number+%s+%s', [lkform.edit3.text, edit3.text]);
if S <> '' then
begin
adoquery1.Close;
adoquery1.sql.Clear;
adoquery1.sql.Add('update suppy_info');
adoquery1.sql.Add(S);
adoquery1.sql.Add('from suppy_info,jc_details');
adoquery1.sql.Add('and suppy_info.suppy_id=' + '''' + edit1.Text + '''');
adoquery1.execsql;
end;
end;