procedure TForm3.Button2Click(Sender: TObject);
begin
adoquery1.Edit;
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select * from fs where xh="'+dbtext1.Caption+'"');
adoquery1.open;
adoquery1.Active:=true;
if str<>'' then
adoquery1.FieldByName('str').AsString:=str;
end;我是delphi新手,不知道为什么出在哪里?一按确定就弹出dataset not in edit or insert mode
哪位大哥可以帮我解决一下
begin
adoquery1.Edit;
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select * from fs where xh="'+dbtext1.Caption+'"');
adoquery1.open;
adoquery1.Active:=true;
if str<>'' then
adoquery1.FieldByName('str').AsString:=str;
end;我是delphi新手,不知道为什么出在哪里?一按确定就弹出dataset not in edit or insert mode
哪位大哥可以帮我解决一下
procedure TForm3.Button2Click(Sender: TObject);
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select * from fs where xh="'+dbtext1.Caption+'"');
adoquery1.open;
adoquery1.Edit;
if str <>'' then
adoquery1.FieldByName('str').AsString:=str;
end;
procedure TForm3.Button2Click(Sender: TObject);
begin
adoquery1.Close; //等同于 adoquery1.Active:=false;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select * from fs where xh="'+dbtext1.Caption+'"');
adoquery1.open; //等同于 adoquery1.Active:=true;
if str <>'' then
begin
adoquery1.FieldByName('str').AsString:=str;
adoquery1.Post;
end;
end;
begin
adoquery1.Close; //等同于 adoquery1.Active:=false;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select * from fs where xh="'+dbtext1.Caption+'"');
adoquery1.open; //等同于 adoquery1.Active:=true;
if str <>'' then
begin
adoquery1.Edit; //进入编辑状态
adoquery1.FieldByName('str').AsString:=str; //也可以写成adoquery1['str']:=str;
adoquery1.Post; //保存编辑结果
end;
end;
对不起,少了一个 Edit
procedure TForm3.Button2Click(Sender: TObject);
begin
adoquery1.Close; //等同于 adoquery1.Active:=false;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select * from fs where xh="'+dbtext1.Caption+'"');
adoquery1.open; //等同于 adoquery1.Active:=true;
if str <>'' then
begin
adoquery1.Edit;
adoquery1.FieldByName('str').AsString:=str;
adoquery1.Post;
end;
end;
begin
adoquery1.Close; //等同于 adoquery1.Active:=false;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select * from fs where xh="'+dbtext1.Caption+'"');
adoquery1.open; //等同于 adoquery1.Active:=true;
if str <>'' then
begin
adoquery1.Edit;//如果你想做插入动作的话这里改为 adoquery1.append
adoquery1.FieldByName('str').AsString:=str;
adoquery1.Post;
end;
end;