当前位置:主页>销售管理软件> 列表

access数据库问题 找进销存需求

销售管理软件版1楼: 我是个菜鸟,写了个算工资的小软件用两个(adoconnetcion,adoquery,datasource,dbgrid)连接了的两个access数据库,都有字段工号,我想把2中的几个字段的值复制到1中工号相同的字段中
begin
repeat
begin
adoquery2.first;
//下面的定位那里错了么
[u]if adoquery2.locate(''工號'',adoquery2.fieldbyname(''工號'').asstring,[loCaseInsensitive, loPartialKey]) then[/u]
begin
AdoQuery1.Append;
adoquery1.fieldbyname(''績效工資'').asstring:=adoquery2.fieldbyname(''績效工資'').asstring;
end;
adoquery1.next;
end;
until adoquery1.Eof;
end;
上面的执行后只增加了一个空行,请各位教我下

2楼: [u]if adoquery2.locate(''工號'',adoquery2.fieldbyname(''工號'').asstring,[loCaseInsensitive, loPartialKey]) then[/u]
是不是应该为
[u]if adoquery1.locate(''工號'',adoquery2.fieldbyname(''工號'').asstring,[loCaseInsensitive, loPartialKey]) then[/u] 如进销存需求

3楼: 一、


begin
repeat
begin
adoquery2.first;
//下面的定位那里错了么
if adoquery2.locate(''工號'',adoquery2.fieldbyname(''工號'').asstring,[loCaseInsensitive, loPartialKey]) then
begin
AdoQuery1.Append;
adoquery1.fieldbyname(''績效工資'').asstring:=adoquery2.fieldbyname(''績效工資'').asstring;
post; //这里至关重要!!!!!!!!!!!

end;
adoquery1.next;
end;
until adoquery1.Eof;
end;

二、你先前已经提出了同样的问题,究竟结没结帖?

4楼: if adoquery2.locate(''工號'',adoquery2.fieldbyname(''工號'').asstring,[loCaseInsensitive, loPartialKey]) then
这个条件应该是没有成立吧?

5楼: 先谢谢各位热心朋友的帮助,

现在还是有问题......执行后在1的最下面加了个空行

我的目的是 如果1,2的工号相同的,就把2的績效工資复制到1的中去

begin
repeat
begin
adoquery2.first;
if adoquery2.locate(''工號'',adoquery2.fieldbyname(''工號'').asstring,[loCaseInsensitive, loPartialKey]) then


begin
AdoQuery1.Append;
adoquery1.fieldbyname(''績效工資'').asstring:=adoquery2.fieldbyname(''績效工資'').asstring;
adoquery1.post;
end;
adoquery1.next;
end;
until adoquery1.Eof;
end;

6楼: update base set 1.xx := 2.xx where 1.a = 2.a

销售管理软件版7楼: 用两个(adoconnetcion,adoquery,datasource,dbgrid)连接了的两个access数据库,都有字段工号,我想把2中的几个字段的值复制到1中工号相同的字段中
没有反应
adoquery2.first;
while not adoquery1.Eof do
begin
if adoquery1.Locate(''工号'',adoquery2.fieldbyname(''工号'').asstring,[loCaseInsensitive, loPartialKey])
then
begin
adoquery1.append;
adoquery1.FieldByName(''绩效工资'').AsString := adoquery2.FieldByName(''合计'').AsString ;
adoquery1.Post;
adoquery2.Next;
end;
end;

8楼: adoquery2.first;
while not adoquery[red]2[/red].Eof do
begin
if adoquery1.Locate(''工号'',adoquery2.fieldbyname(''工号'').asstring,[loCaseInsensitive, loPartialKey])
then
begin
adoquery1.append;
adoquery1.FieldByName(''绩效工资'').AsString := adoquery2.FieldByName(''合计'').AsString ;
adoquery1.Post;
adoquery2.Next;
end;
end;

9楼: begin
repeat
begin
adoquery2.first;
//下面自己對自己定位錯了
{ if adoquery2.locate(''工號'',adoquery2.fieldbyname(''工號'').asstring,[loCaseInsensitive, loPartialKey]) then }
// 修改   注意:不是表1查表2就是表2查表1  不要自己對自己查
if adoquery2.locate(''工號'',adoquery1.fieldbyname(''工號'').asstring,[loCaseInsensitive, loPartialKey]) then
begin
AdoQuery1.Append;
adoquery1.fieldbyname(''績效工資'').asstring:=adoquery2.fieldbyname(''績效工資'').asstring;
end;
adoquery1.next;
end;
until adoquery1.Eof;
end;

10楼: adoquery2.first;
while not adoquery2.eof do
begin
if adoquery1.Locate(''工号'',adoquery2.fieldbyname(''工号'').asstring,[])


then begin
adoquery1.Edit;
adoquery1.FieldByName(''绩效工资'').AsString := adoquery2.fieldbyname(''合计'').asstring;
adoquery1.Post;
end;
adoquery2.Next;
end;