for i:=0 to checklistbox1.Items.Count-1    do
 checklistbox1.Checked[i]:=true;
 adoquery2.SQL.Clear;
 adoquery2.SQL.Add('update user_info set che_flag=1 where  用户编号='+st.Strings[0]);
 adoquery2.ExecSQL;怎么就写了第一条啊?

解决方案 »

  1.   

    for i:=0 to checklistbox1.Items.Count-1    do
    begin
      checklistbox1.Checked[i]:=true;
      adoquery2.SQL.Clear;
      adoquery2.SQL.Add('update user_info set che_flag=1 where  用户编号='+st.Strings[0]);
      adoquery2.ExecSQL;
    end;
      

  2.   

    st.String[0]是什么,如果不一样,也要跟着变的。
      

  3.   

    st.String[0]是不一样的
    但是只更新了第一条数据啊·?
      

  4.   

    楼主?st.Strings[0] 是什么·?
    st.Strings[i]??
      

  5.   

    for i:=0 to checklistbox1.Items.Count-1    do 
    begin 
      checklistbox1.Checked[i]:=true; 
      adoquery2.SQL.Clear; 
      adoquery2.SQL.Add('update user_info set che_flag=1 where  用户编号='+st.String[i]); 
      adoquery2.ExecSQL; 
    end; 
    看看
      

  6.   

    var
     i,j:integer;
     st:Tstringlist;
    begin
    st:=Tstringlist.Create;
           st.Delimiter:='|';
           st.DelimitedText:=trim(CheckListBox1.Items[CheckListBox1.itemindex]);for i:=0 to checklistbox1.Items.Count-1    do 
      begin
      checklistbox1.Checked[i]:=true;  adoquery2.SQL.Clear;
     adoquery2.SQL.Add('update user_info set che_flag=1 WHERE 用户编号='+st.Strings[0]) ;
      adoquery2.ExecSQL;  end;
    end;不行··那个是每一行显示的|之前内容··
      

  7.   

    var 
    i,j:integer; 
    st:Tstringlist; 
    begin 
    st:=Tstringlist.Create; 
          st.Delimiter:='|'; 
    for i:=0 to checklistbox1.Items.Count-1    do 
      begin 
      checklistbox1.Checked[i]:=true; 
      st.DelimitedText:=trim(CheckListBox1.Items[i]); 
      adoquery2.SQL.Clear; 
    adoquery2.SQL.Add('update user_info set che_flag=1 WHERE 用户编号='+st.Strings[0]) ; 
      adoquery2.ExecSQL;   end; 
    end;