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
//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
解决方案 »
- delphi调用outlook发邮件
- 怎么老跳出database login
- 关于多线程读文件问题。
- 哪位高手曾用Delphi与PLC(欧姆龙)进行串口读写通讯?望不吝赐教!!!!!!
- 在安装Ehlib控件时,为何总是提示dbsumlst.dcu文件找不到?(初学者,很急!)
- 打印的问题,为什么我用delphi的qrmemo打印memo的内容时,有些行对不齐??
- 使用SelectDirectory函数后,当前窗口为什么跑到后面去了?up有分!
- 有什么办法可以控制EDIT中只能输入英文和数字,不能输入中文
- listview的viewstyle属性为vsIcon,删除中间某一个item,界面不刷新
- “AOBOCODE。。。”HEX字符串转成TBytes ?如何转
- 求助:动态创建窗体后,线程出现错误
- 我没有学过数据结构,帮我写一个左孩子右兄弟的代码吧
或者
...
Parameters.ParamByName('a').Value:=a;
execsql;
...
sql语句提交后要刷新的。
......
execsql;
adoquery2.requery;
.....