在delphi中,我添加了数据,但是当我点击添加按钮时,TDBGrid中会多出现一行,我不想让他出现,如何解决?
我添加了ADOTable1、DataSource1两个控件,程序如下:procedureTyanjiusheng.Button1Click(Sender:TObject)...
我添加了ADOTable1、DataSource1两个控件,
程序如下:
procedure Tyanjiusheng.Button1Click(Sender: TObject);
begin
adotable1.Last;
adotable1.Insert;
adotable1.FieldByName('教师编号').AsString:=inttostr(id);
adotable1.FieldByName('从').AsString:=dbedit1.text;
adotable1.FieldByName('至学年').AsString:=dbedit2.text;
adotable1.FieldByName('学期').AsString:=dbedit3.text;
adotable1.FieldByName('任课班级').AsString:=dbedit4.text;
adotable1.FieldByName('课程名称').AsString:=dbedit5.text;
adotable1.FieldByName('班级人数').AsString:=dbedit6.text;
adotable1.FieldByName('教学方式').AsString:=dbcombobox1.text;
adotable1.Post;
end; 展开
程序如下:
procedure Tyanjiusheng.Button1Click(Sender: TObject);
begin
adotable1.Last;
adotable1.Insert;
adotable1.FieldByName('教师编号').AsString:=inttostr(id);
adotable1.FieldByName('从').AsString:=dbedit1.text;
adotable1.FieldByName('至学年').AsString:=dbedit2.text;
adotable1.FieldByName('学期').AsString:=dbedit3.text;
adotable1.FieldByName('任课班级').AsString:=dbedit4.text;
adotable1.FieldByName('课程名称').AsString:=dbedit5.text;
adotable1.FieldByName('班级人数').AsString:=dbedit6.text;
adotable1.FieldByName('教学方式').AsString:=dbcombobox1.text;
adotable1.Post;
end; 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询