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
解决方案 »
- 1.sql2000 的连接属于tcp? 2.如何测试本机SocketServer可以建立多少tcp连接?(用clientsocket和socketserver写的网络通讯程序)
- DLL中用 SendMessage HWND 字符串消息
- [急,在线等待]非常简单问题,如何防止程序运行两次?CreateMutex具体方法?
- DELPHI的IDE怎么是这样的呢?
- 祝贺深思老弟当上DataBase版的版主,特把分放光庆祝
- 请高手告诉我怎解决,很简单------当场给分!!!!!!!!!!!!!!!!!!!!!!
- 我想学写控件
- 我想学游戏编程(delphi),不知道买什么样的入门书?
- reportbuilder报表工具中有分页符吗?
- B/S 中,在ActiveForm 中放置了 DBImage 控件,在客户端怎么加载该图片?
- TChart能实现这种效果吗?
- delphi XE2 TStyleManager的问题
或者
...
Parameters.ParamByName('a').Value:=a;
execsql;
...
sql语句提交后要刷新的。
......
execsql;
adoquery2.requery;
.....
如果不是把你的sql语句先放到access里执行一下看看效果,确定不是sql语句的问题
application.MessageBox('修改成功!','提示:',MB_OK);
Parameters.ParamByName('a').Value:=a;
Parameters.ParamByName('a').Value:=a;