情况是这样的~~~首先接受一个c_count的int值,然后在一个动态生成的dbgrid中,我的鼠标选定了一个值以后,在button1上单击,则dbgrid中我选定的那个值所在的那一行的另外一个值做出改变(由0变成1)。而且接下来的c_count-1行的也要由0变成1。
eg:  a      b        c        d
  1       1       1          0
  2       2       2          0
  3       3       3         0
  4       4        4        0
  5       5        5        0shi事先接受了c_count为2,然后,我的鼠标点击中a中的1,然后单击button1,则d中第一行0变成1,而且第二行的0也变成1~~另外也只能在a行上面接受鼠标的点击~~
呵呵,菜鸟一只,经验不错,分数不够~希望各位达人相助,谢谢谢谢了~~~~
一定100分送上~~~~~~

解决方案 »

  1.   

    不知道理解的对不对:)
    取选定的行号,一个循环
    for i:=当前行号 to 下c_count-1行 do
    update语句这样可以吗??
      

  2.   

    edit,//当前行
    update
    DataSet.Next, //下一行
    update
      

  3.   

    for i:=当前行号 to 下c_count-1行 do
    update语句
      

  4.   

    在button1的click事件中写:
    begin
      inttostr(trim(dbgrid1.datasource.dataset.fieldByname(dbgrid1.Columns.Items[4].FieldName).Asstring)):=inttostr(trim(dbgrid1.datasource.dataset.fieldByname(dbgrid1.Columns.Items[4].FieldName).Asstring))+1;
      dbgrid1.Datasource.dataset.next;
      inttostr(trim(dbgrid1.datasource.dataset.fieldByname(dbgrid1.Columns.Items[4].FieldName).Asstring)):=inttostr(trim(dbgrid1.datasource.dataset.fieldByname(dbgrid1.Columns.Items[4].FieldName).Asstring))+1;
      dbgrid1.datasource.dataset.refresh;
    end;