例如我有查询语句update tablename set height=:man_height where myid=:input_id
使用CommandText加Param可以搞定,但是我想用控件的方法实现,可以吗?谢谢指教

解决方案 »

  1.   

    因为我的dataset保存了查询数据'select * from mytable'
    我怕执行了其他sql语句会使这些数据没了
      

  2.   

    问题要修改,
      ds.Edit;
      if ds.Locate('CS_CarID', '粤A V403', [loCaseInsensitive]) then
        ds.FieldByName('CS_WinID').Value := 2;
    我的dataset使用编程时选定的SQL语句,其所有字段都是ReadOnly=false,显示用的DBGrid也是
    ReadOnly=false,
    为什么执行到最后一句就报异常:dataset is not in edit or insert mode呢?
    我的插入操作都能顺利执行的啊。
    顺便说说,我的dataset是clUseClient的。(有关系吗?!)
      

  3.   

    当你调用Edit使DataSet处于可编辑状态之后,如果你对数据库进行了提交,那么DataSet的状态就变成ReadOnly了.
    提一下,DataSet的ReadOnly=False的时候数据库也不一定处于可编辑状态.
      

  4.   

    if ds.Locate('CS_CarID', '粤A V403', [loCaseInsensitive]) then
    begin
        ds.Edit;
        ds.FieldByName('CS_WinID').Value := 2;
    end;
    这样就可以了