procedure TForm9.FormShow(Sender: TObject);begin
//edit2.Visible:=false;
 edit1.Text:=yhs;
 a:= form2.adoquery2.fieldbyname('id').Asinteger;
 ComboBox4.Text := form2.adoquery2.fieldbyname('zc').AsString;
 ComboBox3.Text := form2.adoquery2.fieldbyname('ly').AsString;
 DateTimePicker4.DateTime := form2.adoquery2.fieldbyname('date1').Asdatetime;
 ComboBox1.Text := form2.adoquery2.fieldbyname('je').AsString;
 edit1.text := form2.adoquery2.fieldbyname('yh').AsString;
 memo1.text := form2.adoquery2.fieldbyname('bz').AsString;
 edit2.Text:=inttostr(a);
end;procedure TForm9.Button1Click(Sender: TObject);begin with adoquery1 do
   begin   close;
   sql.Clear;
   sql.Add('update sj set date1='''+datetostr(DateTimePicker4.DateTime)+''',zc='''+ComboBox4.text+''',ly='''+ComboBox3.text+''',je=''+ComboBox1.text+'',bz='''+memo1.Text+''' where [id]=:a ');   execsql;
         application.MessageBox('修改成功!','提示:',MB_OK);
    close;
   end;提示修改成功
数据库不更新!
a为全局变量
ID为主键 自动编号
ACCESS

解决方案 »

  1.   

    ... where [id]=+Quotedstr(IntToStr(a))
    或者
    ...
    Parameters.ParamByName('a').Value:=a;
    execsql;
    ...
      

  2.   

    是不是刷新的问题。
    sql语句提交后要刷新的。
    ......
    execsql;
    adoquery2.requery;
    ..... 
     
      

  3.   

    同意2L
    如果不是把你的sql语句先放到access里执行一下看看效果,确定不是sql语句的问题
      

  4.   

    执行一下,打开ACCESS确认下是否更改了数据,应该是刷新 问题。
      

  5.   

    execsql;   执行后应该判断它的返回值来判断是否成功 而不是后边直接提示成功if execsql = 1 then  //=1表示影响的行数为1 
      application.MessageBox('修改成功!','提示:',MB_OK);
      

  6.   

    [id]=:a 这里:a是参数 要对他进行赋值
    Parameters.ParamByName('a').Value:=a;
      

  7.   

    [id]=:a 这里:a是参数 要对他进行赋值
    Parameters.ParamByName('a').Value:=a;